Skip to contents

Computes the LAR coefficient path. Every active predictor keeps exactly the same absolute correlation with the residual throughout – the equiangularity that distinguishes LAR from forward stepwise, which takes the full least-squares step and destroys it. This is LAR proper, without the lasso modification, so coefficients never leave the active set.

Usage

morie_esl_least_angle_reg(
  X,
  y,
  max_steps = NULL,
  standardize = TRUE,
  method = c("lar", "lasso")
)

Arguments

X

Predictors, n by p.

y

Response.

max_steps

Number of LAR steps; defaults to min(p, n - 1).

standardize

Scale columns to unit norm first. Correlations are not comparable across differently-scaled predictors, so turning this off makes the entry order depend on the units.

method

"lar", or "lasso" for the lasso modification (ESL Alg. 3.2a): a coefficient reaching zero leaves the active set, giving the piecewise-linear lasso path as lars(type = "lasso").

Value

List with coef_path (in original units), coef, intercept, active (1-based entry order), correlations, r_squared.

References

Efron, B., Hastie, T., Johnstone, I., & Tibshirani, R. (2004). Least angle regression. Annals of Statistics 32(2), 407-499.

Examples

set.seed(1)
X <- matrix(rnorm(600), ncol = 5)
y <- 5 * X[, 3] - 2 * X[, 1] + rnorm(120, sd = 0.1)
morie_esl_least_angle_reg(X, y)$active[1:2]
#> [1] 3 1