๐Ÿงฎ Brain Teaser

The Ghost Feature: When a Useless Predictor Inflates OLS Variance

You have a response YโˆˆRnY \in \mathbb{R}^n and a design matrix XโˆˆRnร—pX \in \mathbb{R}^{n \times p} with p<np < n, full column rank. You fit OLS and get coefficient estimates ฮฒ^=(XโŠคX)โˆ’1XโŠคY\hat{\beta} = (X^\top X)^{-1} X^\top Y.

Now you add a new predictor column zโˆˆRnz \in \mathbb{R}^n that is completely independent of YY (i.e., zz carries zero signal: the true coefficient of zz is 0). You refit OLS on the augmented design X~=[Xโˆฃz]\tilde{X} = [X \mid z].

Question: Show that the residual sum of squares (RSS) of the augmented model satisfies

RSS~โ‰คRSS,\widetilde{\text{RSS}} \leq \text{RSS},

with equality if and only if zz is orthogonal to the residual vector e^=Yโˆ’Xฮฒ^\hat{e} = Y - X\hat{\beta}.

Then explain the following seeming paradox: adding a useless predictor decreases RSS (or keeps it the same), yet it increases the unbiased estimate of ฯƒ2\sigma^2. How can removing signal make our noise estimate go up?

Hint for the paradox: think about what the unbiased estimator of ฯƒ2\sigma^2 looks like in each model.

OLSdegrees of freedomprojectionvariance estimationoverfitting

Answer: The Ghost Feature: Useless Predictor Inflates OLS Variance

Key Idea / Intuition

Adding any new predictor to OLS can only decrease RSS โ€” the model now has a strictly larger column space to project onto, so the residual vector can only get shorter (or stay the same). Yet the unbiased variance estimator ฯƒ^2=RSS/(nโˆ’p)\hat{\sigma}^2 = \text{RSS}/(n-p) divides by the degrees of freedom, which drops by 1 each time we add a predictor. When the new predictor is useless, the decrease in RSS is tiny (it only absorbs noise), but we pay a full degree of freedom โ€” so the denominator shrinks while the numerator barely budges, inflating the estimate. This is the statistical cost of overfitting: we spend a degree of freedom to fit noise.


Formal Proof / Solution

Part 1: RSS~โ‰คRSS\widetilde{\text{RSS}} \leq \text{RSS}

Let H=X(XโŠคX)โˆ’1XโŠคH = X(X^\top X)^{-1}X^\top be the hat matrix for the original model, and e^=(Iโˆ’H)Y\hat{e} = (I - H)Y the residual vector, so RSS=โˆฅe^โˆฅ2\text{RSS} = \|\hat{e}\|^2.

The augmented model has column space C(X~)=C([Xโˆฃz])\mathcal{C}(\tilde{X}) = \mathcal{C}([X \mid z]), which satisfies

C(X)โІC(X~).\mathcal{C}(X) \subseteq \mathcal{C}(\tilde{X}).

OLS minimizes โˆฅYโˆ’X~ฮฒ~โˆฅ2\|Y - \tilde{X}\tilde{\beta}\|^2 over all ฮฒ~\tilde{\beta}, i.e., it projects YY onto C(X~)\mathcal{C}(\tilde{X}). Since projecting onto a larger subspace can only reduce (or maintain) the distance to YY:

RSS~=โˆฅYโˆ’P^X~Yโˆฅ2โ‰คโˆฅYโˆ’P^XYโˆฅ2=RSS.\widetilde{\text{RSS}} = \|Y - \hat{P}_{\tilde{X}} Y\|^2 \leq \|Y - \hat{P}_X Y\|^2 = \text{RSS}.

Equality condition. Equality holds iff P^X~Y=P^XY\hat{P}_{\tilde{X}} Y = \hat{P}_X Y, i.e., adding zz does not move the projection. This happens iff zz lies in C(X)\mathcal{C}(X) or zz is orthogonal to e^\hat{e} (the component of YY outside C(X)\mathcal{C}(X)). More precisely, the augmented projection adds to P^XY\hat{P}_X Y a component along the part of zz orthogonal to C(X)\mathcal{C}(X). Let zโŠฅ=(Iโˆ’H)zz^\perp = (I-H)z be the residual of regressing zz on XX. The extra reduction in RSS is

RSSโˆ’RSS~=(e^โŠคzโŠฅ)2โˆฅzโŠฅโˆฅ2\text{RSS} - \widetilde{\text{RSS}} = \frac{(\hat{e}^\top z^\perp)^2}{\|z^\perp\|^2}

(by the formula for adding one predictor to OLS). This is zero iff e^โŠฅzโŠฅ\hat{e} \perp z^\perp, i.e., iff e^โŠฅz\hat{e} \perp z (since He^=0H\hat{e} = 0). โ– \blacksquare


Part 2: The Paradox โ€” RSS Falls but ฯƒ^2\hat{\sigma}^2 Rises

The unbiased estimator of ฯƒ2\sigma^2 in each model is:

ฯƒ^orig2=RSSnโˆ’p,ฯƒ^aug2=RSS~nโˆ’pโˆ’1.\hat{\sigma}^2_{\text{orig}} = \frac{\text{RSS}}{n - p}, \qquad \hat{\sigma}^2_{\text{aug}} = \frac{\widetilde{\text{RSS}}}{n - p - 1}.

When zz is a pure noise predictor independent of YY:

  • The extra reduction RSSโˆ’RSS~=(e^โŠคz)2โˆฅzโŠฅโˆฅ2\text{RSS} - \widetilde{\text{RSS}} = \frac{(\hat{e}^\top z)^2}{\|z^\perp\|^2} is small โ€” it is the squared correlation of zz with the residual, which is random noise of order O(1)O(1).
  • The denominator drops from nโˆ’pn-p to nโˆ’pโˆ’1n-p-1, a fixed decrement of 1.

Concretely, one can show that if zz is genuinely orthogonal to the true signal:

E[RSS~]=(nโˆ’pโˆ’1)ฯƒ2,E[RSS]=(nโˆ’p)ฯƒ2.\mathbb{E}[\widetilde{\text{RSS}}] = (n - p - 1)\sigma^2, \qquad \mathbb{E}[\text{RSS}] = (n-p)\sigma^2.

So dividing by the correct degrees of freedom restores unbiasedness in each case. But the augmented model uses up one degree of freedom fitting noise, leaving fewer to estimate ฯƒ2\sigma^2 with, hence higher variance in the estimate and a numerically inflated value when the noise happens to fit in the "right" direction.

One-line summary of the paradox:

RSS measures total unexplained variation; degrees of freedom measure how many independent errors remain. Adding a noise variable steals one degree of freedom while giving back almost no reduction in RSS โ€” so the ratio goes up, not down.

This is precisely why adjusted R2R^2 and information criteria (AIC, BIC) penalize model complexity: raw RSS always decreases with more predictors, but the true noise floor estimate worsens.

Source: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman (2nd ed.) โ€” Ch. 3

Type: ML/StatsSource: The Elements of Statistical Learning, Hastie, Tibshirani, Friedman (2nd ed.) โ€” Ch. 3Edit on GitHub โ†—