Ridge regression and MSE

6 次查看(过去 30 天)
Robby
Robby 2011-3-21
Hi I am comparing MSE of OLS and ridge regression in order to determine which estimate is best. Is there some command or procedure in MATLAB how to get MSE of the ridge estimate??
Thanks

采纳的回答

John D'Errico
John D'Errico 2011-3-21
Well, since MSE is simply the mean of the squares of the errors...
MSE = mean((y-yhat).^2);
Won't that suffice?

更多回答(4 个)

Robby
Robby 2011-3-21
But how do you get yhat for ridge regression in matlab? for OLS you simply do regstats command, but what command do you use for ridge regression statistics? is there one?
Thanks.

Richard Willey
Richard Willey 2011-3-21
Use the "scaled" option to restore the coefficient estimates to the scale of the original data.
You can then use b to estimate yhat.
b = ridge(y,X,k,scaled) uses the {0,1}-valued flag scaled to determine if the coefficient estimates in b are restored to the scale of the original data

Robby
Robby 2011-3-21
So for the 'scaled' option I use original data matrix X and response variable y (i.e. uncentered and unscaled)? If so, beta will have a constant included, and so in order to estimate yhat I need to add a column of ones in X right?
Thanks again

pemfir
pemfir 2011-12-11
there are 2 version of MSE MSE = SSE/(n-q) unlike what John D'Errico said this is not simply the mean of errors. notice the denominator. it is n-q where q is the number of parameters in the model.
the second MSE which you should use (sometimes people use "mse" lower case to differentiate it with the first MSE) is MSE = bias^2 + var Since ridge regression tries to reduce Var by introducing bias, the second version is what you need to use.
the expression for it is a bit long, but you can find it easily in regression books such as "introduction to linear regression analysis" by Montgomery in the chapter on "multicollinearity"

标签

Community Treasure Hunt

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

Start Hunting!

Translated by