Skip to contents

Uses glmnet if available; otherwise the base-R coordinate-descent fallback. Both solve:

Usage

morie_penalized_regression(
  x,
  y,
  alpha = 0.5,
  lam = 1,
  max_iter = 1000,
  tol = 1e-06
)

Arguments

x

(n x p) predictor matrix.

y

Numeric response.

alpha

0 (ridge) to 1 (LASSO).

lam

Penalty strength.

max_iter, tol

Convergence controls.

Value

list(estimate, beta, intercept, se, alpha, lam, n_iter, n, p, method).

Details

min 1/(2n) ||y - X beta||^2 + lam (alpha ||beta||_1 + (1-alpha)/2 ||beta||_2^2).

References

Friedman, Hastie & Tibshirani (2010); Montesinos Lopez Ch 6.

Examples

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