[R] Question on ridge regression with R

Greg Snow Greg.Snow at intermountainmail.org
Fri Apr 13 16:13:41 CEST 2007


Since the lm.ridge function does not have a weights argument, here are a
couple of alternatives:

1:  The lasso does something along the same lines as ridge regression
and the l1ce function in the lasso2 package has a weights argument, you
could try that approach and see if it gives you want you want.

2:  Standard regression solves the matrix equation (x'x)b = x'y for b,
weighted regression solves the equation (x'Wx)b = x'Wy for b where W is
the matrix of weights (diagonal matrix for wls, covariance matrix for
gls).  Now if you have a matrix w such that w'w = W (just the square
root of the weights if using the diagonal matrix) and you define x* = wx
and y*=wy, then if you do regular regression (ols) on y* and x* you get:

(x*'x*)b = x*'y* => ( (wx)'(wx) ) b = (wx)'(wy) => ( x'w'wx )b = x'w'wy
=> (x'Wx)b = x'Wy 

Which is the weighted least squares (wls).  So doing a regular
regression on y* and x* gives a weighted regression, so it would stand
to reason that doing a ridge regression on y*=wy and x*=wx would give
something along the lines of a weighted ridge regression (I am not an
expert on ridge regression, so I don't know if there are any hidden
traps to this approach).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Benny Wong
> Sent: Thursday, April 12, 2007 2:37 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Question on ridge regression with R
> 
> Hi,
>   I am working on a project about hospital efficiency. Due to 
> the high multicolinearlity of the data, I want to fit the 
> model using ridge regression. However,  I believe that the 
> data from large hospital(indicated by the number of  patients 
> they treat a year)  is more accurate than from small 
> hosptials, and I want to put more weight on them. How do I do 
> this with lm.ridge?
> I know I just need to put "weights=***" in lm function, but 
> for lm.ridge, i don't see that option in lm.ridge.
> 
> Could somebody give me suggestions on that?
> 
> 
> thanks
> ben
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list