Ridge regression and MSE
조회 수: 6 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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?
댓글 수: 0
추가 답변 (4개)
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
댓글 수: 0
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"
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!