tolerance value and variance-inflation factor in stepwiselm

조회 수: 17 (최근 30일)
JIHOON KIM
JIHOON KIM 2023년 5월 16일
댓글: JIHOON KIM 2023년 6월 4일
"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