Decompose Test MSE into Bias², Variance, and Noise
Statistics & ExperimentsModel answerLast updated
Derive and numerically compute the bias-variance decomposition of MSE for a concrete estimator, then reason about model selection trade-offs.
Setting
You are evaluating two regression estimators — call them Model A and Model B — on a held-out test set drawn from the same distribution used for training.
A colleague hands you the following numbers, estimated via repeated bootstrap resampling over 500 independent training runs:
| Metric | Model A | Model B |
|---|---|---|
| Average prediction at a fixed point x₀ | 3.20 | 2.95 |
| True value f(x₀) | 3.00 | 3.00 |
| Variance of predictions at x₀ | 0.05 | 0.40 |
| Irreducible noise variance σ² | 0.10 | 0.10 |
What You Are Expected to Do
-
Derive the bias-variance-noise decomposition of the expected mean squared error (MSE) from first principles. Show every step.
-
Compute the expected MSE at point x₀ for both models using the numbers above.
-
Interpret the results: which model would you deploy, and why might the better model on this single point still be the wrong choice in general?
-
Discuss two concrete techniques — one that reduces variance and one that reduces bias — and explain the trade-off each introduces.
-
Identify at least two common mistakes practitioners make when reasoning about or acting on bias-variance diagnostics.
No code is required. Show your reasoning step by step, state any assumptions, and give a final recommendation.
</summary>Hints
Hint 1
Start the derivation by adding and subtracting E[f̂(x₀)] inside the squared-error expression, then expand the square — be careful about which cross-term vanishes and why.
Hint 2
Bias is a property of the estimator's average behavior, not a single prediction. Make sure you square the signed bias before summing.
Hint 3
A model with lower MSE at one point can still have higher integrated MSE across the full input space — think about what the bootstrap estimate does and does not capture.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
1. Derivation from First Principles
Assume the data-generating process is:
Y = f(x) + ε, where E[ε] = 0, Var(ε) = σ²
We want to decompose the expected squared error of estimator f̂ at a fixed point x₀:
MSE = E[(Y − f̂(x₀))²]
The expectation is taken over both the randomness in training data (which drives f̂) and the noise ε in the new observation Y.
Step 1 — Separate observation noise from estimation error.
Y − f̂ = (Y − f(x₀)) + (f(x₀) − f̂(x₀))
= ε + (f(x₀) − f̂(x₀))
Step 2 — Expand the square.
E[(Y − f̂)²] = E[ε²] + 2·E[ε·(f(x₀) − f̂(x₀))] + E[(f(x₀) − f̂(x₀))²]
The cross-term is zero because ε is independent of f̂ (the estimator depends only on training data, which is independent of the new noise), and E[ε] = 0.
So:
MSE = σ² + E[(f(x₀) − f̂(x₀))²]
Step 3 — Add and subtract E[f̂(x₀)].
Let μ̂ = E[f̂(x₀)]. Then:
f(x₀) − f̂(x₀) = (f(x₀) − μ̂) + (μ̂ − f̂(x₀))
Expanding:
E[(f(x₀) − f̂(x₀))²]
= (f(x₀) − μ̂)² + 2·(f(x₀) − μ̂)·E[μ̂ − f̂(x₀)] + E[(μ̂ − f̂(x₀))²]
The middle cross-term is zero because E[μ̂ − f̂(x₀)] = μ̂ − μ̂ = 0.
Therefore:
MSE = σ² + (f(x₀) − E[f̂(x₀)])² + E[(f̂(x₀) − E[f̂(x₀)])²]
= Noise + Bias² + Variance
This is the bias-variance-noise decomposition.
2. Numerical Computation
Signed bias = E[f̂(x₀)] − f(x₀)
| Model A | Model B | |
|---|---|---|
| Signed bias | 3.20 − 3.00 = +0.20 | 2.95 − 3.00 = −0.05 |
| Bias² | 0.04 | 0.0025 |
| Variance | 0.05 | 0.40 |
| Noise σ² | 0.10 | 0.10 |
| Expected MSE | 0.19 | 0.5025 |
Model A has the lower expected MSE at x₀ despite a larger bias, because its variance is dramatically smaller (0.05 vs. 0.40).
3. Interpretation and Caveats
Which model to deploy at x₀? Model A, straightforwardly. Its total expected error is 0.19 vs. 0.50 for Model B.
Why this might be the wrong general conclusion:
- The bootstrap estimate reflects a single point x₀. Model A may be a high-bias model (e.g., strong regularization) that systematically underestimates in complex regions of the input space. Integrated MSE over the full distribution could reverse the ranking.
- The 500 training runs tell us about estimation variance, not about distribution shift. A low-variance model may be low-variance because it ignores signal, which hurts on out-of-distribution inputs.
- If the true goal is calibration or ranking rather than squared error, MSE decomposition may not be the right lens at all.
Always evaluate on a diverse test partition that reflects the deployment distribution, not a single representative point.
4. Techniques: Reducing Variance vs. Reducing Bias
Reducing variance — Bagging / ensemble averaging
Train K independent models and average their predictions. If models have individual variance V and are weakly correlated (pairwise correlation ρ), the ensemble variance is approximately:
V_ensemble ≈ ρV + (1−ρ)V/K
As K grows, variance approaches ρV. The bias of the ensemble equals the average bias of its members — bagging does not change bias. The trade-off: K× the compute and storage cost; individual models must be diverse (different bootstrap samples or random feature subsets), otherwise ρ → 1 and the gain disappears.
Reducing bias — Boosting / residual fitting
Sequentially fit models to the residuals of the previous ensemble. Each stage targets the remaining systematic error (bias). The trade-off: each added stage slightly increases variance and risks overfitting, especially with deep base learners; early stopping or shrinkage (learning rate) is required to control the variance inflation.
5. Common Practitioner Mistakes
Mistake 1 — Treating a single training run as evidence of bias or variance.
Bias and variance are properties of the estimator over repeated datasets. A single model that predicts 3.20 at x₀ could be a low-bias model that happened to draw a high-noise training set. You need repeated sampling (bootstrap, cross-validation over many splits) to reliably estimate the two components separately.
Mistake 2 — Optimizing bias and variance on the training set.
Training error consistently underestimates bias (the model has seen the labels) and gives no direct signal on estimation variance. Practitioners who pick regularization strength by minimizing training MSE will systematically under-regularize, mistaking low training bias for a good bias-variance trade-off. Always use a held-out validation set or cross-validation.
Mistake 3 (bonus) — Assuming the decomposition is additive in the same way for classification losses.
The clean additive decomposition above holds for squared error. For 0-1 loss or cross-entropy, the decomposition still exists conceptually but the terms interact multiplicatively in some formulations (Domingos 2000). Carrying squared-error intuitions directly into classification can mislead model selection.
Final Recommendation
Deploy Model A at x₀. Its expected MSE (0.19) is less than half that of Model B (0.50), driven by far lower variance. Before committing globally, audit integrated MSE across the input space and assess whether Model A's systematic +0.20 upward bias is acceptable for the downstream task. If variance is the dominant problem (as here), bagging or stronger regularization are the right levers; if bias dominates, reduce regularization or add model capacity with early stopping.