This function dose k-fold cross-validation for the Elastic-net logistic regression and returns a value of lambda.
CV.ElasLogistic(X, Y, lambda = NULL, alpha = 0.5, alpha.i = 1,
folds = 5)
a matrix of predictors.
a vector of the binary response.
a user-supplied sequence of lambda. Tuning parameter lambda imposes sparsity. If it is left as NULL, a default sequence will be used.
the elastic-net mixing parameter, with \(0 \le \alpha \le 1\). alpha=1 is the lasso penalty, and alpha=0 the ridge penalty.
by default, the program use the lasso 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 assign alpha.i to be -1, program will use zero as initial coefficients.
the number of folds for cross-validation.
a list with components:
the optimal lambda.
the misclassification rate of the optimal lambda.
a matrix of the misclassification rates for all the values of lambda tested.