Performs cross-validation (CV) for Lasso regression and plots the results in order to select the optimal Lasso parameter.
lassoCV(formula, data, K = 10, fraction = seq(0, 1, by = 0.05), trace = FALSE,
plot.opt = TRUE, sdfact = 2, legpos = "topright", ...)
MSEP values at each value of fraction
standard errors for each value of fraction
SEP value for each value of fraction
index of fraction with optimal choice for fraction
optimal value for fraction
all values considered for fraction
formula, like y~X, i.e., dependent~response variables
data frame to be analyzed
the number of segments to use for CV
fraction for Lasso parameters to be used for evaluation, see details
if 'TRUE', intermediate results are printed
if TRUE a plot will be generated that shows optimal choice for "fraction"
factor for the standard error for selection of the optimal parameter, see details
position of the legend in the plot
additional plot arguments
Peter Filzmoser <P.Filzmoser@tuwien.ac.at>
The parameter "fraction" is the sum of absolute values of the regression coefficients
for a particular Lasso parameter on the sum of absolute values of the regression
coefficients for the maximal possible value of the Lasso parameter (unconstrained
case), see also lars
.
The optimal fraction is chosen according to the following criterion:
Within the CV scheme, the mean of the SEPs is computed, as well as their standard
errors. Then one searches for the minimum of the mean SEPs and adds
sdfact*standarderror. The optimal fraction is the smallest fraction with an MSEP
below this bound.
K. Varmuza and P. Filzmoser: Introduction to Multivariate Statistical Analysis in Chemometrics. CRC Press, Boca Raton, FL, 2009.
cv.lars
, lassocoef
data(PAC)
# takes some time: # res <- lassoCV(y~X,data=PAC,K=5,fraction=seq(0.1,0.5,by=0.1))
Run the code above in your browser using DataLab