[R] cv.lars() function in LARS package

Niels Richard Hansen Niels.R.Hansen+lists at math.ku.dk
Fri Apr 8 06:05:24 CEST 2011


Cross validation is based on random splits of the data, hence
it can not be expected that the results are exactly identical.

If you want to do lasso, the glmnet package by the same authors
is a better choice.

- Niels

On 07/04/11 16.08, minxolee wrote:
> I am trying to get familiar with the lars package and find out by repeating
> the cv.lars() function, I am not getting the same result consistently. Could
> someone help on that? Here is a simple reproducible example.
>> library(lars)
>> data(diabetes)
>> attach(diabetes)
>> cv.lars(x,y,K=2)
>> cv.lars(x,y,K=2)
> The last two runs of cv.lars give out different cross-validation plots.
> Thanks,
> minxolee
> --
> View this message in context: http://r.789695.n4.nabble.com/cv-lars-function-in-LARS-package-tp3434822p3434822.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at r-project.org 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.

Niels Richard Hansen                     Web:   www.math.ku.dk/~richard	
Associate Professor                      Email: Niels.R.Hansen at math.ku.dk
Department of Mathematical Sciences             nielsrichardhansen at gmail.com
University of Copenhagen                 Skype: nielsrichardhansen.dk	
Universitetsparken 5                     Phone: +1 510 502 8161	
2100 Copenhagen Ø

More information about the R-help mailing list