🧮 Brain Teaser

The Variance of a Least-Squares Estimator: Why Does It Shrink Along High-Variance Directions?

Consider the standard linear regression model:

y=Xβ+ε,εN(0,σ2I)y = X\beta + \varepsilon, \quad \varepsilon \sim \mathcal{N}(0, \sigma^2 I)

where XX is an n×pn \times p matrix with SVD X=UDVTX = UDV^T (singular values d1d2dp>0d_1 \geq d_2 \geq \cdots \geq d_p > 0).

The ordinary least-squares (OLS) estimator is β^=(XTX)1XTy\hat{\beta} = (X^TX)^{-1}X^Ty.

Now consider ridge regression:

β^λ=(XTX+λI)1XTy\hat{\beta}_\lambda = (X^TX + \lambda I)^{-1}X^Ty

Question: Show that the variance of the OLS estimator, Var(β^)\text{Var}(\hat{\beta}), has its largest directions aligned with the smallest singular values of XX. Then explain in one sentence why this makes ridge regression a natural fix: specifically, what does ridge do to these high-variance directions, and why is there a bias-variance trade-off?

(You do not need to do any heavy computation — the key is a clean geometric/spectral insight.)

ridge regressionSVDbias-variance tradeofflinear regressionspectral geometry

Answer: Variance of OLS Along Singular Directions and Ridge Shrinkage

Key Idea / Intuition

The OLS estimator's variance matrix is (XTX)1σ2(X^TX)^{-1}\sigma^2. The directions in which the data XX has the least spread (smallest singular values) are exactly the directions where the estimator is most uncertain — because the data gives you almost no information about β\beta in those directions. Ridge regression simply inflates the denominator in those directions, shrinking the estimate toward zero and dramatically reducing variance at the cost of introducing some bias.


Formal Proof / Solution

Step 1: Variance of OLS in the SVD basis

Using X=UDVTX = UDV^T, we get:

XTX=VD2VTX^TX = VD^2V^T

so the OLS covariance matrix is:

Var(β^)=(XTX)1σ2=VD2VTσ2\text{Var}(\hat{\beta}) = (X^TX)^{-1}\sigma^2 = V D^{-2} V^T \cdot \sigma^2

In the orthonormal basis given by the columns vjv_j of VV, the variance in direction vjv_j is:

σ2dj2\frac{\sigma^2}{d_j^2}

Key observation: small singular value djd_j \Rightarrow large variance σ2/dj2\sigma^2/d_j^2. The directions XX barely "sees" are exactly the directions where OLS is wildly uncertain.

Step 2: Why this makes geometric sense

The singular value djd_j measures how much XX stretches direction vjv_j: the column Xvj=djujXv_j = d_j u_j. If dj0d_j \approx 0, then many different values of β\beta along vjv_j produce nearly the same predictions XβX\beta, so the data cannot distinguish them — OLS variance blows up.

Step 3: What ridge regression does

The ridge estimator covariance is:

Var(β^λ)=(XTX+λI)1XTX(XTX+λI)1σ2=Vdiag ⁣(dj2(dj2+λ)2)VTσ2\text{Var}(\hat{\beta}_\lambda) = (X^TX + \lambda I)^{-1} X^TX (X^TX + \lambda I)^{-1} \sigma^2 = V \cdot \text{diag}\!\left(\frac{d_j^2}{(d_j^2+\lambda)^2}\right) \cdot V^T \cdot \sigma^2

The variance in direction vjv_j becomes:

dj2σ2(dj2+λ)2\frac{d_j^2 \sigma^2}{(d_j^2 + \lambda)^2}

Compare:

| Direction | OLS variance | Ridge variance | |-----------|-------------|---------------| | Large djd_j | σ2/dj2\sigma^2/d_j^2 (small) | σ2/dj2\approx \sigma^2/d_j^2 (almost unchanged) | | Small djd_j | σ2/dj2\sigma^2/d_j^2 (huge) | dj2σ2/λ2\approx d_j^2\sigma^2/\lambda^2 (tiny) |

Ridge massively shrinks variance in the dangerous low-djd_j directions.

Step 4: The bias-variance trade-off in one sentence

Ridge shrinks β^λ\hat{\beta}_\lambda toward zero along the low-variance-data directions (introducing bias λβj/(dj2+λ)\propto \lambda \cdot \beta_j / (d_j^2 + \lambda)), but in return achieves a dramatic reduction in variance, so for an appropriate λ\lambda the mean squared error =Bias2+Variance= \text{Bias}^2 + \text{Variance} is smaller than OLS — this is the classic bias-variance trade-off.

Summary picture

σ2dj2OLS varianceridgedj2σ2(dj2+λ)2ridge variance+λ2βj2(dj2+λ)2bias2\underbrace{\frac{\sigma^2}{d_j^2}}_{\text{OLS variance}} \xrightarrow{\text{ridge}} \underbrace{\frac{d_j^2 \sigma^2}{(d_j^2+\lambda)^2}}_{\text{ridge variance}} + \underbrace{\frac{\lambda^2 \beta_j^2}{(d_j^2+\lambda)^2}}_{\text{bias}^2}

The smallest singular values contribute the biggest variance reduction and the biggest bias — ridge is trading one for the other, and the optimal λ\lambda balances them.

Source: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman (2nd ed.), Chapter 3

Type: ML/StatsSource: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman (2nd ed.), Chapter 3Edit on GitHub ↗