How do I obtain standarized coefficients when applying a stepwise multilinear regression?
3 次查看(过去 30 天)
显示 更早的评论
Hello everyon
I'm using the stepwisefit function between the predictor variable X(69,8) and the response variable y. Each column in X (predictor) is previously standardized as well as the response variable. After applying the function as follows: B = stepwisefit(X,y), only two predictors appears to be in the model given the statistical significance by default (0.05). The problem is that I expect these coefficients to range between +1 and -1 due to previous standardization, but the values are 2.0251 and -2.2983. I need them to be standardized so that I can calculate the percentage of explained variance by each one.
Thanks in advance for your help!
0 个评论
采纳的回答
the cyclist
2019-7-16
I'm not sure I would necessarily expect coefficients to be in that range, even for normalized variables. Can you quote a reference for that?
Here is one simple example of a straightforward OLS regression that defies your expectation. Granted, I am using highly negatively correlated explanatory variables.
N = 100;
x1 = randn(N,1);
x2 = -x1 + 0.2*randn(N,1);
y = 2 + 3*x1 + 4*x2 + 0.7*randn(N,1);
x1n = (x1 - mean(x1))/std(x1);
x2n = (x2 - mean(x2))/std(x2);
yn = (y - mean(y))/std(y);
Xn = [x1n,x2n];
mdl = fitlm(Xn,yn)
figure
scatter(x1n,x2n)
5 个评论
the cyclist
2019-7-16
I don't have access to that paper.
If your explanatory variables are uncorrelated with each other, things are simple. The fraction of variance explained by each variable is the square of its correlation coefficient with the response variable. (You don't need a model for that.)
You can also double-check this as follows ...
If you call your function like this
[b,se,pval,inmodel,stats,nextstep,history] = stepwisefit(...)
then
history.rmse
will give the progression of RMSE as you add variables.
1 - history.rmse.^2
gives the progression of explained variance.
Because your explanatory variables are uncorrelated, the additional explained variance is due completely to the variable added to the model at that stage.
(There will be a bit of rounding error.)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!