- Introduced by
- Hoerl, A.E. & Kennard, R.W.
- Year
- 1970
- Type
- L2-regularized linear regression
What does it do?
Ridge Regression is an L2-regularized linear regression method, introduced by Arthur E. Hoerl and Robert W. Kennard in 1970.
It adds a penalty on the squared size of the coefficients, which stabilizes estimates when predictors are highly correlated, at the cost of some bias. Unlike LASSO, it shrinks coefficients toward zero without setting any of them exactly to zero.
The intuition behind the method
When predictors are strongly correlated, ordinary least squares coefficients become unstable and can change substantially from one sample to the next. Ridge Regression deliberately accepts a small amount of bias in exchange for much lower variance. It does this by adding a penalty on the squared size of the coefficients, which keeps all variables in the model with smaller, steadier weights. Hoerl and Kennard described this as adding small positive quantities to the diagonal of X'X, which makes the estimation problem better conditioned.
History
Ridge Regression was introduced by Arthur E. Hoerl and Robert W. Kennard in 1970 in Technometrics, as a way to obtain biased but more stable estimates when predictor vectors are not orthogonal and ordinary least squares becomes unreliable. Their paper also introduced the ridge trace, a two-dimensional display of the effects of nonorthogonality. Later penalized methods, including the LASSO and Elastic Net listed among related methods, build on the same idea of penalizing coefficients.
When to use it
Choose Ridge Regression for predictive modelling with a continuous outcome when predictors are strongly correlated and you want to keep all of them, for example when variance inflation factors are high (a common rule of thumb treats a VIF above 10 as high). It assumes an approximately linear relationship between predictors and outcome, and features must be standardized before fitting. Do not use it when collinearity is mild, since plain linear regression is then more interpretable. If the goal is to select a subset of variables, prefer LASSO or Elastic Net. As a rule of thumb, with fewer than about 30 observations, cross-validated tuning of alpha becomes unreliable.
Limitations and considerations
- It performs no variable selection: irrelevant predictors keep small nonzero coefficients, which makes a sparse model harder to obtain than with LASSO.
- Shrunken coefficients are biased by design, so their magnitudes should not be read as unshrunken effect sizes.
- The penalty depends on coefficient scale, so the fitted coefficients change with feature scaling unless features are standardized.
- It assumes a linear relationship between predictors and outcome; the penalty does not add flexibility for nonlinear effects.
- With small samples, the cross-validated choice of alpha is noisy, and when collinearity is not a real problem, ordinary linear regression may be adequate.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The L2 penalty stabilizes coefficient estimates when predictors are correlated, because it shrinks them rather than letting them fluctuate freely with the sample.
- Every predictor stays in the model with a nonzero, though shrunken, coefficient, which suits settings where all candidate variables are considered relevant.
- It trades a controlled increase in bias for reduced variance, which can improve out-of-sample prediction when ordinary least squares coefficients are unstable.
- It has one tuning parameter, alpha, with a clear meaning: alpha equal to zero gives ordinary least squares.
- Its solution is an augmented form of the least-squares normal equations, so it remains computable when X'X is nearly singular.
Applications
- Prediction with many correlated predictors, where multicollinearity inflates the variance of ordinary least squares coefficients.
- Stabilizing regression coefficients when variance inflation factors are high (a common rule of thumb treats VIF above 10 as high).
- Modelling in which all candidate predictors should be retained rather than selected away.
- A regularized baseline before comparing against LASSO or Elastic Net.
How it works
How it works
Ordinary least squares chooses coefficients by minimizing squared error alone. When predictors are nearly redundant, the least-squares solution is poorly determined and changes markedly with small changes in the data. Ridge addresses this by adding a small positive term to the diagonal of X'X, as Hoerl and Kennard proposed. This accepts some bias in exchange for much smaller variance and more stable coefficients.
Ridge minimizes the residual sum of squares plus alpha times the sum of the squared slope coefficients. The penalty pulls the coefficient vector toward zero as a whole. Unlike LASSO, it does not set any coefficient exactly to zero, so all predictors remain in the model. With uncorrelated, standardized predictors, each OLS coefficient is scaled by 1/(1 + alpha). When predictors are correlated, the shrinkage is not uniform: an individual ridge estimate can even exceed its OLS value, although the estimates are shrunk overall. Because the penalty depends on coefficient magnitude, features should be standardized first; otherwise variables measured on larger scales are penalized more heavily. The intercept is not penalized: the penalty sum runs over the slope coefficients only.
Formula
\hat{\beta}^{\text{ridge}} = \arg\min_{\beta_0,\beta_1,\ldots,\beta_k} \; \sum_{i=1}^{n} \left(y_i - \beta_0 - \sum_{j=1}^{k} \beta_j x_{ji}\right)^2 + \alpha \sum_{j=1}^{k} \beta_j^2The parameter alpha sets the penalty strength: larger values shrink the coefficients more, and alpha equal to zero recovers ordinary least squares. Alpha is the ridge shrinkage parameter and is often written lambda in econometrics texts. A common approach is to scan a range of alpha values, compute the cross-validated mean squared error for each, and choose the value that minimizes it. Plotting the coefficients against alpha, in the spirit of the ridge trace that Hoerl and Kennard introduced, shows how the estimates stabilize as the penalty increases.
Common pitfalls
- Fitting on unstandardized features, so the penalty effectively shrinks variables measured on larger scales more heavily.
- Choosing alpha by eye rather than by cross-validation, which can lead to over- or under-shrinkage.
- Applying Ridge when no real multicollinearity exists, which shrinks coefficients without a clear predictive benefit.
- Expecting variable selection: Ridge keeps all predictors, so a sparse model requires LASSO or Elastic Net.
- Treating shrunken coefficients as ordinary least squares estimates for inference. Standard errors and p-values from a ridge fit need separate treatment, and residual checks for normality and homoscedasticity matter mainly for that inferential step.
Frequently asked questions
How is Ridge different from LASSO?
Both add a penalty to shrink coefficients, but Ridge uses an L2 penalty that shrinks coefficients toward zero without ever reaching it, so all predictors stay in the model. LASSO uses an L1 penalty that can set coefficients exactly to zero, performing variable selection. Choose Ridge to stabilize correlated predictors and LASSO when you need a sparse model.
Do I need to standardize my features?
Yes, in practice you should. The L2 penalty acts on the size of the coefficients, so without standardization variables measured on larger scales would be shrunk more heavily than others.
How do I choose the penalty strength alpha?
Choose alpha by cross-validation: scan a range of values and pick the one that minimizes the cross-validated mean squared error. Plotting the CV MSE curve against alpha shows where the optimum lies.
When should I not use Ridge?
If there is no real multicollinearity, Ridge adds unnecessary shrinkage and a plain linear regression is more interpretable. With very small samples, tuning alpha is unreliable, and if you need to drop irrelevant variables you should use LASSO or Elastic Net instead.
Related methods
Sources
Hoerl, A.E. & Kennard, R.W. (1970). Ridge Regression: Biased Estimation for Nonorthogonal Problems. Technometrics, 12(1), 55–67.
Open DOI reference