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, index, trace = FALSE, plot.it = TRUE, se = TRUE,
type = c("lasso", "lar", "forward.stagewise", "stepwise"),
mode=c("fraction", "step"), ...)
Arguments
x |
Input to lars |
y |
Input to lars |
K |
Number of folds |
index |
Abscissa values at which CV curve should be computed.
If |
trace |
Show computations? |
plot.it |
Plot it? |
se |
Include standard error bands? |
type |
type of |
mode |
This refers to the index that is used for
cross-validation. The default is |
... |
Additional arguments to |
Value
Invisibly returns a list with components (which can be plotted using plotCVlars
)
index |
As above |
cv |
The CV curve at each value of index |
cv.error |
The standard error of the CV curve |
mode |
As above |
Author(s)
Trevor Hastie
References
Efron, Hastie, Johnstone and Tibshirani (2003) "Least Angle Regression" (with discussion) Annals of Statistics; see also https://hastie.su.domains/Papers/LARS/LeastAngle_2002.pdf.
Examples
data(diabetes)
attach(diabetes)
cv.lars(x2,y,trace=TRUE,max.steps=80)
detach(diabetes)