Performs cross-validation to select optimal regularization parameters for GLMnet models.
fit_cvglmnet(formula, data, family = gaussian, alpha = 0.5, ...)
An object of class formula
with a symbolic description
of the model to be fitted.
A data.frame
containing the variables in the model.
A description of the error distribution and link function.
See stats::family
for details.
The elasticnet mixing parameter, between 0 and 1.
See glmnet::glmnet
for details.
Additional parameters passed to glmnet::cv.glmnet
.
A list containing two data frames:
metrics
- Cross-validated performance metrics
coefficients
- Coefficients selected by cross-validation