Learn R Programming

lars (version 1.1)

cv.lars: Computes K-fold cross-validated error curve for lars

Description

Computes the K-fold cross-validated mean squared prediction error for lars, lasso, or forward stagewise.

Usage

cv.lars(x, y, K = 10, index, 
    trace = FALSE, plot.it = TRUE, se = TRUE,type = c("lasso", "lar", "forward.stagewise", "stepwise"),
         mode=c("fraction", "step"), ...)

Arguments

Value

Invisibly returns a list with components (which can be plotted using plotCVlars)indexAs abovecvThe CV curve at each value of indexcv.errorThe standard error of the CV curvemodeAs above

References

Efron, Hastie, Johnstone and Tibshirani (2003) "Least Angle Regression" (with discussion) Annals of Statistics; see also http://www-stat.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf.

Examples

Run this code
data(diabetes)
attach(diabetes)
cv.lars(x2,y,trace=TRUE,max.steps=80)
detach(diabetes)

Run the code above in your browser using DataLab