Learn R Programming

regnet (version 0.2.0)

CV.ElasLogistic: k-folds cross-validation for Elastic-Net logistic regression.

Description

This function does k-fold cross-validation for the Elastic-Net logistic regression and returns the optimal value of lambda.

Usage

CV.ElasLogistic(X, Y, lambda = NULL, alpha = 0.5, alpha.i = 1,
  folds = 5, verbo = FALSE)

Arguments

X

a matrix of predictors.

Y

a vector of the binary response.

lambda

a user-supplied sequence of lambda values, which serves as a tuning parameter to impose sparsity. If it is left as NULL, a default sequence will be used.

alpha

the Elastic-Net mixing parameter, with \(0 \le \alpha \le 1\). alpha=1 corresponds to the lasso penalty, and alpha=0 corresponds to the ridge penalty.

alpha.i

by default, the program uses the lasso penalty for choosing initial values of the coefficient vector. alpha.i is the Elastic-Net mixing parameter, with \(0 \le alpha.i \le 1\). alpha.i=1 is the lasso penalty, and alpha.i=0 the ridge penalty. If alpha.i is assigned to be -1, the program will use zeroes as initial coefficients.

folds

the number of folds for cross-validation.

verbo

output progress to the console.

Value

a list with components:

lambda

the optimal lambda.

mcr

the misclassification rate of the optimal lambda.

MCR

a matrix of the misclassification rates for all the values of lambda tested.

References

Zou H, Hastie T. (2005). Regularization and variable selection via the elastic net. J.R. Statist.Soc.B, 67(2):301<U+2013>20.

See Also

ElasLogistic