[R] LASSO coefficients for a specific s

Seungho Huh Seungho.Huh at sas.com
Tue Jun 12 16:24:48 CEST 2007


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



More information about the R-help mailing list