tolerance value and variance-inflation factor in stepwiselm

27 次查看(过去 30 天)
"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?

采纳的回答

Aditya Srikar
Aditya Srikar 2023-5-26
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Model Building and Assessment 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by