Tutorials › Exam SRM - Statistics for Risk Modeling › Why Test Error Can Rise With Complexity

Exam SRM · Bias, Variance, and Overfitting · Tutorial 762 of 926

Why Test Error Can Rise With Complexity

Use the bias-variance-noise decomposition to explain when added model complexity improves prediction and when its increase in estimation variance outweighs its reduction in bias.

Intermediate 12 min read

What You'll Learn

  • Define expected test error for a new response and separate it from error on the training sample.
  • Derive the squared-error decomposition into squared bias, estimation variance, and irreducible noise.
  • Compare changes in bias and variance to determine whether greater complexity raises or lowers expected test error.
  • Interpret expected-error calculations when predictions are averaged over different parts of a target population.
  • Recognize why a U-shaped expected-error curve is possible but not universal.
  • Identify the error in assuming that lower training error guarantees lower test error.

Why More Complexity Can Help—and Then Hurt

A more flexible model can represent patterns that a simpler model cannot. That can bring its predictions closer to the target and reduce approximation bias. But a flexible fitting procedure can also respond more strongly to the particular training sample, increasing estimation variance. Expected test error reflects both effects, as well as the randomness of a new response. If variance eventually grows faster than bias falls, test error rises.

The comparison concerns expected test error: the average squared prediction error over repeated training samples and fresh test responses from the target population. It does not say that every observed test-error curve must have a particular shape. In particular, seeing a U-shaped curve is not a requirement for a model to be sensible or for a complexity measure to be useful.

Definition: For a fixed predictor input \(x\), let \(Y_0=f(x)+\varepsilon_0\) be a fresh response, where \(f(x)\) is its conditional mean and \(E[\varepsilon_0\mid x]=0\), \(\operatorname{Var}(\varepsilon_0\mid x)=\sigma^2(x)\). Let \(\hat f_c(x)\) be the prediction from a fitting procedure of complexity \(c\), trained on a random sample independent of \(Y_0\). Its expected test error under squared-error loss is \(E[(Y_0-\hat f_c(x))^2]\), where the expectation averages over both the training sample and the fresh response.

Here, complexity might be indexed by the number of parameters, the size of a tree, or another measure of a learner’s flexibility. These measures are not interchangeable, and complexity need not describe every aspect of a fitting procedure. The decomposition below applies to a specified prediction procedure at a specified input; a population-level expected test error can then average that quantity over inputs \(X_0\) in the target population.

The Bias-Variance-Noise Decomposition

Write \(\bar f_c(x)=E[\hat f_c(x)]\), where the expectation is over training samples. The bias at \(x\) is \(\bar f_c(x)-f(x)\); the variance is \(\operatorname{Var}(\hat f_c(x))\). The fresh response has conditional noise variance \(\sigma^2(x)\).

$$ E[(Y_0-\hat f_c(x))^2] = \big(\bar f_c(x)-f(x)\big)^2 + \operatorname{Var}(\hat f_c(x)) + \sigma^2(x). $$

The first term is squared bias, the second is estimation variance, and the third is irreducible noise for this prediction target. “Irreducible” means it remains even if the predictor equals the true conditional mean \(f(x)\); it does not mean that the response itself is constant.

Why the decomposition holds

Add and subtract \(f(x)\) from the prediction error, and use \(Y_0=f(x)+\varepsilon_0\):

$$ Y_0-\hat f_c(x)=\varepsilon_0-\big(\hat f_c(x)-f(x)\big). $$

Squaring and taking expectations gives the noise variance, the squared prediction error of \(\hat f_c(x)\) relative to \(f(x)\), and a cross-product. The cross-product has expectation zero: the fresh noise has conditional mean zero and is independent of the training sample used to construct \(\hat f_c(x)\). Finally, for any random variable \(Z\) and constant \(a\), \(E[(Z-a)^2]=\operatorname{Var}(Z)+(E[Z]-a)^2\). Applying this with \(Z=\hat f_c(x)\) and \(a=f(x)\) gives the first two terms of the decomposition.

Important qualification: A reduction in approximation bias and an increase in estimation variance often occur as complexity grows, but neither change is a universal rule for every fitting procedure and dataset. Even when bias falls and variance rises, their relative sizes determine whether expected test error falls or rises. Noise is unchanged across complexity levels when the prediction target and population are fixed.

Worked Examples

Worked Example: Expected Error Falls, Then Rises

At one fixed input \(x\), a hypothetical response satisfies \(Y_0=f(x)+\varepsilon_0\), with \(\varepsilon_0\sim N(0,1)\). Three fitted predictors have the following distributions across repeated training samples: for complexity \(c=1,2,3\), respectively, \(\hat f_c(x)\sim N(f(x)+2,0.25)\), \(N(f(x)+1,1)\), and \(N(f(x)+0.5,4)\). The fresh response is independent of each fitted predictor. Find expected test error at each complexity and describe its pattern.

Method. Apply the decomposition. The second parameter in each normal distribution is a variance, so the squared biases are \(2^2=4\), \(1^2=1\), and \(0.5^2=0.25\). The response noise variance is \(\sigma^2(x)=1\) at all three complexity levels.

At \(c=1\), expected error is \(4+0.25+1=5.25\). At \(c=2\), it is \(1+1+1=3\). At \(c=3\), it is \(0.25+4+1=5.25\).

The expected errors are therefore \(5.25, 3,\) and \(5.25\). They fall from \(c=1\) to \(c=2\), then rise at \(c=3\). The final increase in variance more than offsets the further reduction in squared bias. This illustrates one way a U-shaped pattern can arise; it does not establish that all complexity sequences have this shape.

Check. At \(c=3\), the sum \(0.25+4+1\) is \(5.25\), the same expected error as at \(c=1\). The common mistake is to notice that bias is smaller at \(c=3\) and conclude that its test error must also be smaller. The calculation shows why that conclusion fails.

Worked Example: Bias Reduction Can Dominate Rising Variance

A hypothetical prediction problem has fresh-response noise \(\varepsilon_0\sim N(0,0.5)\). At a fixed input, three procedures have training-sample prediction distributions \(\hat f_1\sim N(f+4,0.1)\), \(\hat f_2\sim N(f+2,0.2)\), and \(\hat f_3\sim N(f+1,0.3)\), where \(f=f(x)\); the fresh response is independent of the fitted prediction. Calculate the expected test error at each complexity and decide whether it rises anywhere in this comparison.

Method. Add squared bias, estimator variance, and response noise variance. All three procedures predict at the same input and target, so the noise variance remains \(0.5\).

For \(c=1\), the squared bias is \(4^2=16\), giving error \(16+0.1+0.5=16.6\). For \(c=2\), the squared bias is \(2^2=4\), giving \(4+0.2+0.5=4.7\). For \(c=3\), the squared bias is \(1^2=1\), giving \(1+0.3+0.5=1.8\).

Expected test error decreases at both steps: \(16.6\) to \(4.7\), then \(4.7\) to \(1.8\). Estimation variance does increase, but its increases are smaller than the reductions in squared bias. Thus, increasing variance alone does not imply rising expected test error.

Check. The \(0.5\) noise contribution is included once at every level, and the normal-distribution parameters are variances, not standard deviations. This calculation avoids the mistake of treating any increase in variance as enough to make total error rise.

Worked Example: A Small Bias Gain Is Not Worth the Variance Cost

At one fixed input, let the fresh-response noise be \(\varepsilon_0\sim N(0,0.25)\). The lower-complexity predictor has distribution \(\hat f_L\sim N(f+1.5,0.5)\), and the higher-complexity predictor has distribution \(\hat f_H\sim N(f+0.5,3)\), with \(f=f(x)\). Assume each fresh response is independent of the training sample for its predictor. Compare their expected test errors.

Method. For the lower-complexity predictor, squared bias is \(1.5^2=2.25\). Its expected test error is \(2.25+0.5+0.25=3\).

For the higher-complexity predictor, squared bias is \(0.5^2=0.25\). Its expected error is \(0.25+3+0.25=3.5\). The higher-complexity predictor therefore has \(3.5-3=0.5\) more expected test error.

The reason can be seen by subtracting the two decompositions. The reduction in squared bias is \(2.25-0.25=2\), while the variance increase is \(3-0.5=2.5\). The noise terms cancel, leaving a net increase of \(2.5-2=0.5\). A decrease in bias is not, by itself, enough to justify greater complexity.

Check. Both procedures have the same noise variance, so it cannot explain their error difference. The calculation avoids the trap of comparing only their bias terms.

What the Curve Does—and Does Not—Say

For two complexity levels, subtracting their expected-error decompositions makes the tradeoff explicit:

$$ E[(Y_0-\hat f_{c_2}(x))^2]-E[(Y_0-\hat f_{c_1}(x))^2] = \left(\operatorname{Bias}_{c_2}(x)^2-\operatorname{Bias}_{c_1}(x)^2\right) + \left(\operatorname{Var}(\hat f_{c_2}(x))-\operatorname{Var}(\hat f_{c_1}(x))\right). $$

The noise terms cancel because the target and input are unchanged. If complexity \(c_2\) reduces squared bias by \(a>0\) and increases variance by \(b>0\), the expected-error change is \(-a+b\). Error falls when \(a>b\), is unchanged when \(a=b\), and rises when \(b>a\). The decomposition identifies the balance; it does not guarantee in advance which case will occur.

For a random test input \(X_0\), expected test error averages the fixed-input decomposition over the target distribution of \(X_0\). The relevant bias and variance may differ across regions of the input space. Consequently, an average can hide locations where prediction error rises and others where it falls. A claim about the overall curve must refer to the population and the chosen loss, not just to one convenient input.

Also distinguish the expected curve from the errors obtained in one particular assessment. The decomposition averages over repeated training samples and fresh responses. A finite collection of observed test outcomes can fluctuate around that expectation. Therefore, a single observed increase or decrease does not by itself establish the direction of the underlying expected-error change.

1
Hold the prediction target fixed.
Use the same response definition, input distribution, and loss when comparing complexity levels.
2
Separate the three contributions.
For squared-error prediction, identify squared bias, training-sample variance, and response noise.
3
Compare the changes.
Expected test error rises only if the variance increase exceeds the squared-bias reduction, when the noise contribution is unchanged.
4
Qualify the conclusion.
Describe the result as an expected pattern under the specified setup, not as a curve that every dataset must display.

Common Exam Trap

A frequent error is to treat a lower training error as proof that expected test error fell. Training error evaluates fitted predictions on observations used to build the model; the decomposition here concerns a fresh response and averages over possible training samples. The quantities answer different questions. A more flexible procedure can fit its training sample more closely while having greater training-sample prediction variance.

Another error is to say “complexity increases variance, so test error must rise.” That omits the bias term. The correction is to calculate or compare the net change in squared bias and variance. Conversely, observing less bias does not establish that error fell: as the third worked example shows, variance can increase by more than squared bias decreases. These conclusions are aligned with the SOA Exam SRM (Statistics for Risk Modeling) syllabus.

Key takeaway: Expected test error is not determined by model flexibility alone. Under squared-error loss, greater complexity improves expected prediction only when its reduction in squared bias outweighs its increase in estimation variance; therefore, a U-shaped curve is possible, not inevitable.

Check Your Understanding

For each problem, use expected squared prediction error and distinguish a variance from a standard deviation where distributions are given.

  1. At a fixed input, fresh-response noise has distribution \(N(0,0.25)\). A predictor has training-sample distribution \(N(f+1,2)\), where \(f\) is the true conditional mean. Find its expected test error. (Answer: \(1+2+0.25=3.25\))
  2. At the same input and target, three procedures have squared biases \(9,4,1\), variances \(0.1,0.4,1.5\), and common response-noise variance \(0.4\), in order of increasing complexity. Compute their expected errors and state whether any increase. (Answer: \(9.5,4.8,2.9\); none increases.)
  3. A target population has two equally likely input groups. At a given complexity, squared bias is \(0\) in group A and \(4\) in group B; prediction variance is \(1\) in each group; response-noise variance is \(0.5\) in both. Find the population-averaged expected test error. (Answer: \(0.5(0+4)+1+0.5=3.5\))
  4. At one fixed input, a lower-complexity procedure has squared bias \(0.5\), variance \(0.4\), and noise variance \(0.2\). A higher-complexity procedure has squared bias \(0.1\), variance \(1.2\), and the same noise variance. Find both errors and their difference. (Answer: \(1.1\) and \(1.5\); the higher-complexity error is \(0.4\) greater.)
  5. A fitted model’s training error falls when its complexity increases. Is that enough information to determine whether its expected test error falls? (Answer: No; compare the changes in squared bias and estimation variance for the fresh-response prediction target.)
Clinical Biostats