🧮 Brain Teaser

Ridge Regression as Augmented OLS: The Data-Augmentation Trick

Recall that the ridge regression estimator for y=Xβ+εy = X\beta + \varepsilon minimizes

RSSλ(β)=yXβ2+λβ2.\text{RSS}_\lambda(\beta) = \|y - X\beta\|^2 + \lambda\|\beta\|^2.

Problem: Show that this is exactly equivalent to performing ordinary least squares (no penalty at all) on an augmented dataset (X~,y~)(\tilde{X}, \tilde{y}), where

X~=(XλIp),y~=(y0).\tilde{X} = \begin{pmatrix} X \\ \sqrt{\lambda}\, I_p \end{pmatrix}, \qquad \tilde{y} = \begin{pmatrix} y \\ 0 \end{pmatrix}.

That is, show that β^ridge=(X~TX~)1X~Ty~\hat{\beta}_{\text{ridge}} = (\tilde{X}^T \tilde{X})^{-1}\tilde{X}^T \tilde{y}.

Bonus reflection: What does this say conceptually about what ridge regression is doing to the data?

ridge regressiondata augmentationshrinkagenormal equationsregularization

Answer: Ridge Regression as Augmented OLS

Key Idea / Intuition

Ridge regression penalizes large coefficients by adding λβ2\lambda\|\beta\|^2. The augmentation trick makes this penalty literal: we append pp fake observations with input λej\sqrt{\lambda}\,e_j (the jj-th standard basis vector) and response 00. Predicting 00 for these fake points forces the model to keep βj\beta_j small — otherwise it pays a residual cost. The penalty term in ridge is thus reinterpreted as a genuine least-squares fit to artificial "zero-response" data.


Formal Proof / Solution

Step 1: Write the augmented OLS objective.

The OLS loss on the augmented data (X~,y~)(\tilde{X}, \tilde{y}) is

y~X~β2=(y0)(XλI)β2.\|\tilde{y} - \tilde{X}\beta\|^2 = \left\|\begin{pmatrix} y \\ 0 \end{pmatrix} - \begin{pmatrix} X \\ \sqrt{\lambda}\,I \end{pmatrix}\beta\right\|^2.

Expanding the block structure:

=yXβ2+λβ02=yXβ2+λβ2.= \|y - X\beta\|^2 + \|\sqrt{\lambda}\,\beta - 0\|^2 = \|y - X\beta\|^2 + \lambda\|\beta\|^2.

This is exactly the ridge objective RSSλ(β)\text{RSS}_\lambda(\beta).

Step 2: Compute the OLS normal equations for X~\tilde{X}.

X~TX~=(XTλI)(XλI)=XTX+λI.\tilde{X}^T \tilde{X} = \begin{pmatrix} X^T & \sqrt{\lambda}\,I \end{pmatrix}\begin{pmatrix} X \\ \sqrt{\lambda}\,I \end{pmatrix} = X^T X + \lambda I.

X~Ty~=(XTλI)(y0)=XTy.\tilde{X}^T \tilde{y} = \begin{pmatrix} X^T & \sqrt{\lambda}\,I \end{pmatrix}\begin{pmatrix} y \\ 0 \end{pmatrix} = X^T y.

Step 3: Solve.

The OLS solution on the augmented data is

β^=(X~TX~)1X~Ty~=(XTX+λI)1XTy=β^ridge.\hat{\beta} = (\tilde{X}^T \tilde{X})^{-1}\tilde{X}^T \tilde{y} = (X^T X + \lambda I)^{-1} X^T y = \hat{\beta}_{\text{ridge}}.

(Note: XTX+λIX^T X + \lambda I is always positive definite for λ>0\lambda > 0, so the inverse exists even when XTXX^T X is singular — a secondary benefit of ridge.)

Conceptual interpretation:

The pp fake data points each "observe" a single coefficient in isolation and expect it to be zero. Adding more such points (larger λ\lambda) increases the pressure toward zero. Ridge shrinkage is literally the influence of these phantom zero-observations competing with the real data. This is an instance of the hints framework (Abu-Mostafa 1995): encode prior knowledge (here: "prefer small coefficients") as artificial training examples.

Source: The Elements of Statistical Learning, 2nd ed., Hastie, Tibshirani, Friedman — Ex. 3.12

Type: ML/StatsSource: The Elements of Statistical Learning, 2nd ed., Hastie, Tibshirani, Friedman — Ex. 3.12Edit on GitHub ↗