Skip to contents

Wraps glmnet::glmnet. Returns the coefficient path across the supplied alphas (lambda grid in glmnet terminology).

Usage

morie_regularization_path(
  x,
  y,
  penalty = c("ridge", "lasso", "elasticnet"),
  alphas = NULL,
  l1_ratio = 0.5
)

Arguments

x

Numeric matrix of predictors.

y

Numeric response.

penalty

One of "ridge", "lasso", "elasticnet".

alphas

Lambda grid. Defaults to a logspace.

l1_ratio

glmnet alpha; only used when penalty = "elasticnet".

Value

Named list: estimate, coef_path, alphas, penalty, l1_ratio, n, method.

Examples

# See the package vignettes for usage examples:
#   vignette(package = "rmorie")