# cv.enet

0th

Percentile

##### Computes K-fold cross-validated error curve for elastic net

Computes the K-fold cross-validated mean squared prediction error for elastic net.

Keywords
regression
##### Usage
cv.enet(x, y, K = 10, lambda, s, mode,trace = FALSE, plot.it = TRUE, se = TRUE, ...)
##### Arguments
x
Input to lars
y
Input to lars
K
Number of folds
lambda
s
Abscissa values at which CV curve should be computed. A value, or vector of values, indexing the path. Its values depends on the mode= argument
mode
Mode="step" means the s= argument indexes the LARS-EN step number. If mode="fraction", then s should be a number between 0 and 1, and it refers to the ratio of the L1 norm of the coefficient vector, relative to the norm at the full LS solution. Mode="norm
trace
Show computations?
plot.it
Plot it?
se
Include standard error bands?
...
Additional arguments to enet
##### Value

• Invisibly returns a list with components (which can be plotted using plotCVLars)
• fractionValues of s
• cvThe CV curve at each value of fraction
• cv.errorThe standard error of the CV curve

##### References

Zou and Hastie (2004) "Regularization and Variable Selection via the Elastic Net" In press, Journal of the Royal Statistical Society, Series B.

• cv.enet
##### Examples
data(diabetes)
attach(diabetes)
## use the L1 fraction norm as the tuning parameter
cv.enet(x2,y,lambda=0.05,s=seq(0,1,length=100),mode="fraction",trace=TRUE,max.steps=80)
## use the number of steps as the tuning parameter
cv.enet(x2,y,lambda=0.05,s=1:50,mode="step")
detach(diabetes)
Documentation reproduced from package elasticnet, version 1.02, License: GPL version 2 or newer

### Community examples

Looks like there are no examples yet.