Performs k-fold cross-validation for glmnet, including alpha mixing parameter.
cva.glmnet(x, y, nfolds = 10, alphaSet = seq(0.1, 1, 0.1), foldid = NULL, ...)Object of S3 class "cva.glmnet", which is a list of the cv.glmnet
objects for each value of alpha and alphaSet.
List of fitted glmnet::cv.glmnet objects
Sequence of alpha values used
The mean cross-validated error - a vector of length
length(alphaSet).
Value of alpha giving lowest alpha_cvm.
Index of alphaSet with lowest alpha_cvm
Matrix of predictors
Response vector
Number of folds (default 10)
Sequence of alpha values to cross-validate
Optional vector of values between 1 and nfolds identifying
what fold each observation is in.
Other arguments passed to glmnet::cv.glmnet
Myles Lewis
glmnet::cv.glmnet, glmnet::glmnet