Skip to contents

Simple wrapper for glmnet::glmnet() and glmnet::cv.glmnet().

Usage

mdl_glmnet(y, X, cv = TRUE, ...)

Arguments

y

The outcome variable.

X

The (sparse) feature matrix.

cv

Boolean to indicate use of lasso with cross-validated penalty.

...

Additional arguments passed to glmnet. See glmnet::glmnet() and glmnet::cv.glmnet() for a complete list of arguments.

Value

mdl_glmnet returns an object of S3 class mdl_glmnet as a simple mask of the return object of glmnet::glmnet() or glmnet::cv.glmnet().

References

Friedman J, Hastie T, Tibshirani R (2010). "Regularization Paths for Generalized Linear Models via Coordinate Descent." Journal of Statistical Software, 33(1), 1–22.

Simon N, Friedman J, Hastie T, Tibshirani R (2011). "Regularization Paths for Cox's Proportional Hazards Model via Coordinate Descent." Journal of Statistical Software, 39(5), 1–13.

See also

Examples

glmnet_fit <- mdl_glmnet(rnorm(100), matrix(rnorm(1000), 100, 10))
class(glmnet_fit)
#> [1] "mdl_glmnet" "cv.glmnet"