regress(y,X) yields wrong standardized coefficients, but right unstandardized ones
3 views (last 30 days)
Show older comments
I'm trying to fit a regression to my data and need standardized coefficients, but Matlab doesn't provide these by default, so I z-scored my data first (using normalize instead of zscore because I have NaNs in my data which should not be deleted). The unstandardized coefficients are correct, I compared them to results from a statistics package.
However the standardized coefficients are not right, and I can't figure out why. I tried getting rid of the column of 'ones', tried only zscoring the y and only the X, and all combinations of these steps. Does anyone know what I'm missing?
Standardized coefficients Standardized coefficients Unstandardized coefficients
according to other program: that my script produces: (same both times):
0.1617 0.0494 26.771
0.5709 0.3800 1.057
-0.0579 -0.0656 -0.201
-0.1575 -0.0134 -0.279
Here is a simplified version of the code and I attached the data that produced these results:
mytable(:,3:end) = normalize(mytable(:,3:end))
y = mytable.score
x1 = mytable.MT
x2 = mytable.Age
x3 = mytable.GlobalNorm
X = [ones(size(x1)) x1 x2 x3 x1.*x2];
b = regress(y,X)
0 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!