0

I am using a X and Y data no standarize ($X_{196\times 20}$ and $Y_{196\times 1}$) and I get diferente coefficientes when I use the following formula:

a<-lm.ridge(Y~X, lambda = 0)
b<-lm(Y~X)
as.matrix(b$coefficients)[-1]-as.matrix(a$coef)

why?

When lambda = 0 ridge regression should be the same as OLS.

the lm.ridge formula needs first to standarize the inputs?

will198
  • 669
  • 1
  • 4
  • 9
  • Please search our site: http://stats.stackexchange.com/search?q=ridge+regression+standardize – whuber Mar 21 '17 at 16:19
  • I already know that to performe ridge regression I have to use standarized data but I don't know if the lm.ridge function implemente in R does the standarization by itselves or shoud I standarized first the data. – will198 Mar 21 '17 at 17:32
  • 1
    `lm.ridge` is not a part of base `R`. It must be part of some user-written add-on. Please consult its documentation. If you're still not sure, it's easy to check: do it on the same data with and without standardizing them. If you get the same results both times, then it internally standardizes. Otherwise it doesn't. – whuber Mar 21 '17 at 19:04
  • `lm.ridge` comes from the `MASS` package. It does **not** standardize by default. (As whuber said, try both ways). – thomaskeefe Nov 29 '18 at 01:28

0 Answers0