Re: [R] LASSO coefficients for a specific s

From: Bruno C. <bruno.c_at_inwind.it>
Date: Tue, 12 Jun 2007 20:29:35 +0200


Hy,
no need to find the best s value. CV does it for you: cvres<-cv.lars(X,Y,K=10,type='lasso')
sAtBest<-cvres$fraction[which.min(cvres$cv)] fits <- predict.lars(object, type="coefficients", s=sAtBest, mode="fraction")

...
Ciao
Bruno

> Hello,
>
> I have a question about the lars package. I am using this package to get the coefficients at a specific LASSO parameter s.
>
>
> data(diabetes)
> attach(diabetes)
>
> object <- lars(x,y,type="lasso")
>
> cvres<-cv.lars(x,y,K=10,fraction = seq(from = 0, to = 1, length = 100))
>
> fits <- predict.lars(object, type="coefficients", s=0.1, mode="fraction")
>
>
> Can I assign automatically the best s value to predict.lars which is given by the CV process (cv.lars)? Or, do I need to manually find the s value that gives the minimum cv value from cv.lars, and assign it as the s value in predict.lars?
>
> I would appreciate any advice on this. Thanks,
> Seungho Huh
>
> ______________________________________________
> 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.
>



Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada

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. Received on Tue 12 Jun 2007 - 18:44:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 12 Jun 2007 - 19:32:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.