cv.lars {lars}R Documentation

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, fraction = seq(from = 0, to = 1, length = 100), 
    trace = FALSE, plot.it = TRUE, se = TRUE, ...)

Arguments

x Input to lars
y Input to lars
K Number of folds
fraction Abscissa values at which CV curve should be computed, as a fraction of the saturated |beta|. Default is seq(from = 0, to = 1, length = 100)
trace Show computations?
plot.it Plot it?
se Include standard error bands?
... Additional arguments to lars

Value

Invisibly returns a list with components (which can be plotted using plotCVlars)

fraction As above
cv The CV curve at each value of fraction
cv.error The standard error of the CV curve

Author(s)

Trevor Hastie

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

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

[Package lars version 0.9-7 Index]