How to get lasso fit coefficient(given penalty tuning parameter \lambda) using lars package

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get lasso fit coefficient(given penalty tuning parameter \lambda) using lars package

Michael-2
Hi, all,

         I am using the lars package for lasso estimate. So I get a lasso
fit first:

lassofit = lars(x,y,type ="lasso",normalize=T, intercept=T)
Then I want to get coefficient with respect to a certain value of \lambda
(the tuning parameter), I know lars has three mode options c("step",
"fraction", "norm"), but can I use the \lambda value instead of the norm
which is the L1 norm of coefficients?

Thanks,

Michael

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: How to get lasso fit coefficient(given penalty tuning parameter \lambda) using lars package

Michael-2
Oh, I just realize that I can actually just use this:

beta = coef(lassofit, s=5, mode="lambda")


Michael
On Sun, Dec 5, 2010 at 8:10 PM, michael <[hidden email]> wrote:

> Hi, all,
>
>          I am using the lars package for lasso estimate. So I get a lasso
> fit first:
>
> lassofit = lars(x,y,type ="lasso",normalize=T, intercept=T)
> Then I want to get coefficient with respect to a certain value of \lambda
> (the tuning parameter), I know lars has three mode options c("step",
> "fraction", "norm"), but can I use the \lambda value instead of the norm
> which is the L1 norm of coefficients?
>
> Thanks,
>
> Michael
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: How to get lasso fit coefficient(given penalty tuning parameter \lambda) using lars package

caolinii
I have this problem as well....
Could you please kindly let me know what s is please. Is s equals to the value of lambda?

Many thanks

Lini