- Introduced by
- Hoerl & Kennard (Ridge, 1970); Tibshirani (Lasso, 1996); Zou & Hastie (Elastic Net, 2005)
- Year
- 1970–2005
- Type
- Penalized linear model
- Family
- Machine learning
What does it do?
Regularized linear regression adds a penalty term to the ordinary least-squares objective, shrinking or zeroing out coefficients to reduce overfitting and handle multicollinearity.
The three main variants — Ridge (L2 penalty), Lasso (L1 penalty), and Elastic Net (combined L1+L2) — make linear regression usable even when features outnumber observations or predictors are highly correlated.
The intuition behind the method
Ordinary least squares gives each predictor the coefficient that minimizes in-sample error, which can produce large, unstable coefficients when predictors are correlated or when there are many features. Regularization pulls the coefficients toward zero, so the model accepts a little more training error in exchange for better out-of-sample behaviour. Ridge shrinks coefficients most along the directions of the predictors' principal components that carry the least variance, so correlated predictors tend to receive similar, stabilized weights. Lasso's absolute-value penalty can set some coefficients to exactly zero, which performs feature selection. Elastic Net mixes both penalties and is used when groups of correlated predictors should be kept together.
History
The lasso was introduced by Tibshirani in a 1996 paper in the Journal of the Royal Statistical Society: Series B. It constrains the sum of the absolute values of the coefficients, which tends to set some coefficients exactly to zero and so yields interpretable models; the paper describes the method as having some of the favourable properties of both subset selection and ridge regression. The squared-coefficient (L2) penalty is the basis of Ridge regression and of the L2 component in Elastic Net, which combines the L1 and L2 penalties as shown in the formula above. The Elements of Statistical Learning (Hastie, Tibshirani and Friedman) covers these methods in its chapter on linear regression and shrinkage.
When to use it
Use regularized linear regression when the outcome is continuous, the predictors are numeric, and either the number of features is large relative to the sample size or the predictors are strongly correlated. Ridge is a reasonable default when most candidate predictors are plausibly relevant; Lasso or Elastic Net suit settings where automated feature selection is required. Prefer ordinary unpenalized linear regression when the number of features is small, the predictors are weakly correlated, and the sample is large. When features outnumber observations, ordinary least squares has no unique solution, whereas the penalized fits remain well defined; in that regime the selected variables are especially sensitive to the data and to lambda and should be checked on held-out data. Do not use any linear variant when the relationship is clearly nonlinear and no nonlinear terms have been engineered, or when the outcome is binary or categorical. Logistic regression or tree-based methods are better suited to those cases.
Limitations and considerations
- Assumes a linear relationship between features and the continuous target; misses nonlinear patterns unless features are engineered manually.
- Predictors must be standardized before fitting; without it the penalty treats coefficients on different scales unequally and the estimates are distorted.
- Lasso performs poorly when many truly relevant correlated predictors exist, because it arbitrarily selects one and discards the others; Elastic Net is the safer choice in that setting.
- Ridge retains all features and does not produce a sparse model, which can complicate interpretation when the feature space is very high-dimensional.
- With correlated predictors, an individual ridge coefficient can sometimes be greater than its OLS estimate even though the ridge estimates are shrunk overall, so shrinkage should not be read as a monotone effect on every coefficient.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Coefficients remain linear effects with explicit signs and sizes, so the fitted model can be read term by term once predictors are on a known scale.
- Under strong correlation, Ridge spreads weight across correlated predictors rather than choosing one arbitrarily, while Lasso tends to select one predictor from a correlated group.
- Lasso and Elastic Net set some coefficients exactly to zero, giving a sparse model without a separate selection step.
- Lasso and Elastic Net are fitted efficiently by coordinate descent, and Ridge has a closed-form solution, so routine fitting is practical on moderately large datasets.
- Cross-validated selection of the penalty strength is implemented in common software such as scikit-learn and glmnet.
Applications
- Genomics and bioinformatics: predicting continuous phenotypes from thousands of genetic markers where p >> n.
- Economics and social science: estimating effects of many policy variables on continuous outcomes while controlling for multicollinearity.
- Engineering: predicting physical quantities from sensor arrays with correlated measurements.
- Feature selection pipeline: Lasso or Elastic Net used upstream to identify a small predictor set before fitting a more complex model.
- Finance: forecasting returns or risk measures from many macroeconomic and market factors.
- Healthcare: predicting continuous clinical outcomes from large panels of lab values or imaging-derived features.
How it works
How it works
Before fitting, each predictor is centred and scaled to mean zero and unit variance. This is necessary because the penalty treats every coefficient equally. Without scaling, a predictor measured on a large scale has a small coefficient for a given effect and is therefore penalized less, so the penalty acts unevenly and the coefficients are not comparable. The outcome is usually centred too. The slope coefficients are then fitted under the penalty, and the intercept is recovered afterwards from the outcome and predictor means, so it is never penalized.
The practitioner selects the penalty. Ridge uses the sum of squared coefficients (L2 norm), which shrinks all coefficients but never sets one exactly to zero. Lasso uses the sum of absolute coefficient values (L1 norm), which can set some coefficients exactly to zero and so selects features. As written in the formula, Elastic Net applies both penalties with separate strengths lambda1 (L1) and lambda2 (L2). It is useful when several correlated predictors are relevant. The intercept is not penalized: the penalty sums run over the slope coefficients only.
Formula
\text{Ridge: } \lambda\sum_{j}\beta_j^2 \quad \text{Lasso: } \lambda\sum_{j}|\beta_j| \quad \text{Elastic Net: } \lambda_1\sum|\beta_j|+\lambda_2\sum\beta_j^2The model minimizes the penalized objective: the residual sum of squares plus the chosen penalty. For Ridge this has a closed-form solution. Lasso and Elastic Net generally require coordinate-descent or other iterative optimization, because the absolute-value penalty is not differentiable at zero.
Formula
\hat{\boldsymbol{\beta}} = \arg\min_{\boldsymbol{\beta}} \left[ \|\mathbf{y} - \mathbf{X}\boldsymbol{\beta}\|^2 + \text{penalty}(\boldsymbol{\beta}) \right]The regularization strength lambda is a hyperparameter, usually chosen by cross-validation over a logarithmic grid. A lambda of zero recovers ordinary least squares, and a very large lambda shrinks all coefficients toward zero. For Elastic Net, the two strengths in the formula are tuned in the same way. The best value depends on the dataset and balances bias and variance for that dataset.
Once the penalty strength is fixed and the coefficients are estimated, prediction for a new observation is the same as in ordinary linear regression: the dot product of the features and the estimated coefficients. The model remains interpretable as a linear model, although the shrunken coefficients are biased estimates of the unpenalized effects.
Formula
\hat{y} = \mathbf{x}^\top \hat{\boldsymbol{\beta}}Common pitfalls
- Fitting without standardizing predictors, so the penalty acts unevenly and the coefficients are not comparable across predictors.
- Using a default lambda instead of selecting it by cross-validation. A poorly chosen lambda either under-regularizes (close to ordinary least squares) or over-regularizes (coefficients collapse toward zero).
- Applying regularized linear regression to a binary or count outcome when logistic regression or Poisson regression should be used instead.
- Reporting Lasso variable-selection results as if they were confirmatory. Lasso selection is sensitive to the dataset and lambda, so the selected variables should be treated as exploratory.
- Ignoring the assumption of linearity and reporting a poor-fitting regularized model without checking residuals.
Frequently asked questions
When should I choose Ridge over Lasso?
Choose Ridge when you believe most predictors contribute to the outcome and want stable coefficients without zeroing any out, for example when correlated predictors should all remain in the model. Choose Lasso or Elastic Net when many features may be irrelevant and you want the fit to select a subset.
Do I still get p-values and confidence intervals?
Classical p-values and standard errors are not directly valid after penalized fitting, because the shrunken coefficients are biased by design and the selection step depends on the data. Specialized post-selection inference methods exist but are not covered here. A common alternative is to report resampling-based stability measures, such as how often each predictor is selected across resamples.
How do I choose the regularization strength lambda?
Select lambda by k-fold cross-validation (typically k = 5 or 10) over a logarithmic grid, tuning only on training data. Software such as scikit-learn and glmnet provides this search. Report the lambda chosen and the criterion used, such as the minimum cross-validation error.
Does regularized linear regression require normally distributed features?
No. As in ordinary least squares, the normality and constant-variance assumptions concern the residuals, not the predictors. Highly skewed or outlier-heavy predictors can still distort estimates, so log-transforming skewed inputs is a common preprocessing step.
What is Elastic Net and when is it preferred?
Elastic Net combines the L1 and L2 penalties with separate strengths (lambda1 and lambda2 in the formula). Many software packages reparameterize this as an overall strength and a mixing parameter alpha, where alpha = 1 is pure Lasso and alpha = 0 is pure Ridge. It is preferred when groups of correlated predictors are all relevant: Lasso would tend to select one predictor from the group and drop the rest, while the L2 component encourages the group to be kept together.
Related methods
Sources
Tibshirani, R. (1996). Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society: Series B, 58(1), 267–288.
Open DOI referenceHastie, T., Tibshirani, R. & Friedman, J. (2009). The Elements of Statistical Learning (2nd ed., Ch. 3). Springer.
ISBN: 978-0-387-84858-7Introduction to Econometrics, Global Edition (2020), p. 524
Introduction to Econometrics, 4th Edition, p. 483