Basic Prerequisites: 02 · Point Estimation (MSE) and 03 · The CLT & Sampling (sampling distributions).


1. Intuition & Practical Objective

Why does a model that fits the training data perfectly often predict terribly? Because the error of a model has two sources that trade off against each other, and fitting harder improves one while worsening the other.

  • Bias: systematic error - the model family is not rich enough to represent the truth (a straight line cannot bend).
  • Variance: sensitivity to the particular training sample - a rich model moves wildly when the data changes (a degree-12 polynomial chases noise).

Total expected prediction error = bias² + variance + irreducible noise. The first two sum to a U-shape in model complexity; the minimum is the sweet spot. This is the same decomposition you met in 02 (MSE = Var + Bias²), now applied to predictions rather than parameters. Validation - cross-validation and penalised criteria (AIC, BIC) - is how you find the minimum without cheating by looking at the test set.

Why the grader cares. Every hyper-parameter in a quant pipeline (lookback window, model order, regularisation strength, number of factors) is chosen by this tradeoff. And the canonical way to get it wrong - screening features on the whole dataset before cross-validating - is the most common silent bug in quantitative research.


2. Mathematical Ground Truth & Derivations

2.1 The bias–variance decomposition (ESL eq 2.25 two-term; eq 2.46 / 7.9 three-term)

For a target with , , and an estimator fit on a random training set :

(The noise-free two-term form ESL eq 2.25 drops ; the full three-term form with irreducible error is ESL eq 2.46 / 7.9.) Increasing complexity typically lowers bias and raises variance; the sum is U-shaped.

2.2 In-sample optimism (ESL §7.2–7.4)

Training error always decreases with complexity and is therefore a biased-down estimate of test error. For a linear model with parameters,

The effective degrees of freedom of a linear smoother is (ESL eq 7.32) - not the raw parameter count.

2.3 Cross-validation (ESL §7.10, eq 7.48)

-fold CV splits the data into folds; for each fold fit on the other folds and score on fold :

  • is leave-one-out: low bias, high variance, expensive.
  • or is the recommended compromise.
  • One-standard-error rule: among models within one SE of the minimum CV error, pick the simplest.

2.4 Penalised criteria (ESL eqs 7.29/7.35; Tsay eq 2.16)

Trade fit against complexity without a validation set:

BIC penalises complexity harder ( vs ) and is asymptotically consistent, so it selects simpler models than AIC at finite .

2.5 The wrong way to cross-validate (ESL §7.10.2)

If a screening step (feature selection, variance filter) is applied to the whole dataset before splitting, information leaks from the test folds into training. ESL’s worked example: full-data screening yields an average CV error of 3% where the true error is 50% - a 16× illusion of skill. All data-dependent preprocessing must happen inside each training fold.


3. Computational Implementation - the U-curve, CV, and AIC/BIC

Standard library only. We decompose the prediction error of polynomial fits into bias², variance and irreducible noise; watch in-sample error fall while CV error explodes; and confirm AIC/BIC pick the true (linear) model.

Since the truth is linear, bias² is ~0 for every degree; all the U-shape comes from variance, which climbs steeply with degree (0.026 → 0.736) - the shape of overfitting. In-sample error falls monotonically (0.238 → 0.180) while CV error explodes (0.268 → 55.8); CV and both penalised criteria correctly select degree 1. The lesson is blunt: training error is a liar; only held-out error is honest.


4. Failure Modes & First-Principles Breakdowns

  1. Validating on training data. In-sample error falls monotonically with complexity and says nothing about generalisation. Never report it as performance.
  2. Screening outside the folds (the #1 silent bug). Feature selection or variance filtering on the full dataset before CV leaks the test set into training; ESL demonstrates a 3%-vs-50% illusion. Put every data-dependent step inside the fold loop.
  3. Reusing the test set for selection. If you pick the best model by the test error, the test error is no longer an unbiased estimate - it becomes a training signal. Keep a final “vault” set, or use nested CV.
  4. Choosing complexity by AIC when you want consistency. AIC targets predictive risk and over-selects; BIC is consistent and picks the true model asymptotically. Neither replaces a validation set for non-nested models.
  5. Treating . For regularised/smoothed models the effective df is ; using over-penalises and mis-ranks models.
  6. Ignoring the irreducible floor. No amount of modelling removes ; chasing below it is fitting noise. Compare models against that floor, not against zero.

5. References

  • Hastie, Tibshirani & Friedman, Elements of Statistical Learning
  • Casella & Berger, Statistical Inference
  • Tsay, Analysis of Financial Time Series

6. Connected Graph Bridges