lars (version 1.3)

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

x

Input to lars

y

Input to lars

K

Number of folds

index

Abscissa values at which CV curve should be computed. If mode="fraction" this is the fraction of the saturated |beta|. The default value in this case is index=seq(from = 0, to = 1, length =100). If mode="step", this is the number of steps in lars procedure. The default is complex in this case, and depends on whether N>p or not. In principal it is index=1:p. Users can supply their own values of index (with care).

trace

Show computations?

plot.it

Plot it?

se

Include standard error bands?

type

type of lars fit, with default "lasso"

mode

This refers to the index that is used for cross-validation. The default is "fraction" for type="lasso" or type="forward.stagewise". For type="lar" or type="stepwise" the default is "step"

Additional arguments to lars

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

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

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

Run the code above in your browser using DataLab