[R] Intercept in lasso models
Martin Keller-Ressel
martin at ist.org
Sun Apr 11 21:35:00 CEST 2004
Hello,
Im using the function l1ce (L1-constrained estimation) from the lasso2
package.
when I try the example from the help pages
> data(Prostate)
> l1c.P <- l1ce(lpsa ~ ., Prostate, bound=.5)
> coef(l1c.P)
(Intercept) lcavol lweight age lbph
svi
0.7284810757 0.4936540169 0.2681863403 0.0000000000 0.0092825881
0.4550584943
lcp gleason pgg45
0.0000000000 0.0000000000 0.0001812107
everything looks fine to me. But when I use
> l1c.P <- l1ce(lpsa ~ ., Prostate, bound=(1:20)/20)
> coef(l1c.P)[10,]
(Intercept) lcavol lweight age lbph
-4.9496587740 0.4936540169 0.2681863403 0.0000000000 0.0092825881
svi lcp gleason pgg45
0.4550584943 0.0000000000 0.0000000000 0.0001812107
the Intercept is different !! Also
> coef(l1c.P)[20,]
(Intercept) lcavol lweight age lbph
-23.678040866 0.587022881 0.454460641 -0.019637208 0.107054351
svi lcp gleason pgg45
0.766155885 -0.105473570 0.045135964 0.004525324
should be the same as the unconstrained linear model:
> coef(lm(lpsa ~ ., data = Prostate))
(Intercept) lcavol lweight age lbph
svi
0.669399027 0.587022881 0.454460641 -0.019637208 0.107054351
0.766155885
lcp gleason pgg45
-0.105473570 0.045135964 0.004525324
which is true except for the Intercept...
What is going on here? Can anybody enlighten me?
Thanks,
Martin Keller-Ressel
--
More information about the R-help
mailing list