Effacer les filtres
Effacer les filtres

tolerance value and variance-inflation factor in stepwiselm

22 vues (au cours des 30 derniers jours)
JIHOON KIM
JIHOON KIM le 16 Mai 2023
Commenté : JIHOON KIM le 4 Juin 2023
"In each stepwise regression analysis, predictors were added to
the regression models until the inclusion of the next predictor showed
redundancy or multicollinearity, as indicated by a tolerance value of less
than 0.20 and a variance-inflation factor value of more than 4."
i want to implement the sentence above but i cant find "stepwiselm" options related to tolerance value and variance-inflation factor how can i set them?

Réponse acceptée

Aditya Srikar
Aditya Srikar le 26 Mai 2023
You can set the tolerance value and variance inflation factor (VIF) threshold for multicollinearity in stepwise regression by customizing the options for `stepwiselm` function in MATLAB.
Here's a sample code:
% Define the predictors and response variable
X = [x1, x2, x3, x4, x5];
Y = y;
% Define the options for stepwise regression
options = statset('Display','iter', 'TolFun', 0.01, 'TolTypeFun', 'rel', 'PEnter', 0.05, 'PRemove', 0.1);
% Run the stepwise regression with predefined multicollinearity threshold settings
mdl = stepwiselm(X, Y, 'Criterion', 'bic', 'Upper', 'linear', 'Lower', 'constant', 'PEnter', 0.05, 'PRemove', 0.1, 'Verbose', 1, 'Options', options);
% Check the multicollinearity
[vif, tolerance] = vif(mdl);
% Check for variable inclusion
included_vars = mdl.predictorNames(mdl.Coefficients.Estimate ~= 0);
In the above code, you can customize the tolerance level and VIF threshold by setting the `options.TolFun` and `options.TolTypeFun` parameters respectively.
Please note that these are just sample values and you may need to adjust these parameters based on the requirements of your specific application. Additionally, `vif` function is used to compute the variance inflation factors for the coefficients of the model and `tolerance` function is used to compute the tolerance value for the predictors in the model.
I hope this helps! Let me know if you have any further questions.

Plus de réponses (0)

Produits


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by