Tutorials › Regression Analysis (Undergraduate) › Separating Mean-Pattern Errors from Unequal Spread

Specification Checks and Residual Patterns · Tutorial 577 of 991

Separating Mean-Pattern Errors from Unequal Spread

Learn to tell whether residuals signal a misshaped mean pattern, unequal spread, or both by examining their smooth center and vertical dispersion.

Advanced 10 min read

What You'll Learn

  • Separate residual patterns in the conditional mean from patterns in conditional variance.
  • Use the vertical center of a residual plot to look for mean-pattern errors.
  • Use changes in vertical dispersion to look for unequal spread.
  • Calculate group residual means and sample standard deviations to summarize plot patterns.
  • Recognize when mean-pattern errors and unequal spread appear together.
  • Avoid treating a flat residual smooth as evidence of constant variance.

Two Different Questions in One Residual Plot

A residual plot can look uneven for more than one reason. Its center may rise, fall, or curve across fitted values, suggesting that the model has not captured the conditional average of the response. Or the residuals may remain centered near zero while their vertical spread changes, suggesting that the response is more variable in some parts of the predictor range than in others. These patterns concern different features of the response distribution and should not be confused.

The practical distinction is to inspect the plot in two ways: first, follow the middle of the cloud of points; then compare the cloud’s vertical width at different locations. A smooth line through the residuals can help reveal a change in center, while the thickness of the cloud is evidence about spread. Either feature can change without the other changing, and both can change at once.

Definition: A mean-pattern error occurs when the fitted conditional mean does not match the true conditional mean across predictor values. Unequal spread, also called heteroscedasticity, occurs when the conditional variance of the response errors changes across predictor values. A residual plot can provide evidence about each feature, but a visual pattern is diagnostic evidence, not proof of its cause.

Model and the Two Features Being Checked

For observations \(i=1,\ldots,n\), consider a regression model with fitted conditional mean \(g(X_i)=\beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik}\), where \(X_i\) represents the predictors. The corresponding fitted value is \(\hat{Y}_i\), and the residual is \(e_i=Y_i-\hat{Y}_i\). The fitted model is intended to describe the conditional mean of \(Y_i\) given the predictors.

The classical constant-variance regression assumptions distinguish two claims. The mean claim is that the conditional mean has the specified form. The spread claim is that the conditional variance of the error is the same for every predictor setting. For the familiar model with errors \(\epsilon_i\), these assumptions can be written as follows:

$$ Y_i=g(X_i)+\epsilon_i,\qquad E(\epsilon_i\mid X_i)=0,\qquad \operatorname{Var}(\epsilon_i\mid X_i)=\sigma^2. $$

The first conditional statement says that, at a given predictor setting, the errors average to zero. The variance statement says that their spread around zero does not systematically change with that setting. Independence of errors across observations is a separate assumption often used for regression inference. Normality is not required to distinguish the center from the spread in a residual plot.

In practice, the true errors are not observed. Residuals are estimated from the data after fitting the model, so plots of residuals are approximations to patterns in the errors. In particular, fitting coefficients imposes constraints on the residuals. Interpret smooths and group summaries as clues about the underlying conditional mean and variance, not as exact measurements of them.

Why the Center and the Width Answer Different Questions

Suppose the true conditional mean is \(m(X_i)\), but the fitted model uses \(g(X_i)\). In an idealized comparison where the fitted function is treated as fixed, the discrepancy between the true and fitted mean enters the residual directly:

$$ Y_i-g(X_i) =\bigl[m(X_i)-g(X_i)\bigr]+\bigl[Y_i-m(X_i)\bigr]. $$

If the true errors average to zero conditionally, taking a conditional expectation gives \(E[Y_i-g(X_i)\mid X_i]=m(X_i)-g(X_i)\). Thus a systematic smooth trend in residual centers can reveal a difference between the true mean pattern and the fitted one. By contrast, subtracting a fixed fitted value does not change conditional variance:

$$ \operatorname{Var}\bigl(Y_i-g(X_i)\mid X_i\bigr) =\operatorname{Var}(Y_i\mid X_i). $$

This explains the diagnostic distinction: the vertical location of residuals relates to a mean discrepancy, while their vertical dispersion relates to conditional variance. In an actual fitted model, estimated coefficients and the finite sample complicate this simple argument, which is why the patterns are interpreted as evidence rather than exact identities.

A Practical Reading Strategy

In a residual-versus-fitted plot, the horizontal coordinate is \(\hat{Y}_i\) and the vertical coordinate is \(e_i\). A predictor-specific residual plot uses a predictor on the horizontal axis instead. The two questions are the same in either plot: does the center vary, and does the spread vary?

1
Look for a changing center.
Trace a smooth through the middle of the points. A systematic curve, rise, or fall away from zero suggests that residual averages vary across the horizontal axis. This is evidence of a mean-pattern discrepancy.
2
Look for changing vertical width.
Compare how far points extend above and below the center at different horizontal positions. A widening, narrowing, or otherwise changing band suggests unequal spread.
3
Record the two judgments separately.
Describe the center and the spread independently. A curved center with steady width is not the same diagnosis as a flat center with a fan-shaped width, and both features can coexist.

Binning the horizontal axis and calculating residual means can help summarize the center, particularly when individual points overlap. To compare spread, calculate a within-bin standard deviation or examine the vertical extent of the points. Group summaries simplify a plot but can conceal patterns within bins; a smooth and the underlying points should also be inspected. The sample standard deviation is a measure of spread around the group mean, so it complements rather than replaces the group residual mean.

Worked Example: A Curved Center With Similar Spread

Suppose a hypothetical linear fit is checked by grouping observations into low, middle, and high ranges of a predictor. The residuals in those three groups are listed below. The group sizes are equal, and the group residuals are shown in increasing order.

Predictor rangeResiduals
Low0.5, 1.5, 2.5, 3.5
Middle-5.5, -4.5, -3.5, -2.5
High0.5, 1.5, 2.5, 3.5

Compare the centers. The low-group mean is \((0.5+1.5+2.5+3.5)/4=8/4=2\). The middle-group mean is \((-5.5-4.5-3.5-2.5)/4=-16/4=-4\), and the high-group mean is \(8/4=2\). The sequence of centers, \(2,-4,2\), bends rather than remaining level. It is evidence of a mean-pattern error, with residuals positive at the ends and negative in the middle.

Compare the spreads. In each group, the deviations from that group’s mean are \(-1.5,-0.5,0.5,1.5\). The sample standard deviation in every group is \(\sqrt{(1.5^2+0.5^2+0.5^2+1.5^2)/(4-1)} =\sqrt{5/3}=1.291\). The centers change substantially, but the within-group spread is the same. This example illustrates a changing mean pattern without evidence of changing spread.

Worked Example: A Flat Center With Increasing Spread

In a second hypothetical diagnostic, the residuals from low, middle, and high predictor ranges are as follows:

Predictor rangeResiduals
Low-1, -0.5, 0.5, 1
Middle-2, -1, 1, 2
High-4, -2, 2, 4

Compare the centers. The sum of residuals is zero in each group, so each group mean is \(0/4=0\). The group centers are flat at zero; there is no visible pattern in these summaries that suggests a changing conditional mean.

Compare the spreads. For the low group, the sample standard deviation is \(\sqrt{(1+0.25+0.25+1)/3}=\sqrt{2.5/3}=0.9129\). For the middle group it is \(\sqrt{(4+1+1+4)/3}=\sqrt{10/3}=1.826\). For the high group it is \(\sqrt{(16+4+4+16)/3}=\sqrt{40/3}=3.651\). The residuals remain centered near zero, but the vertical spread grows across the predictor range. This pattern is evidence of unequal spread, not a curved conditional mean.

Worked Example: A Changing Center and a Widening Band

A third hypothetical diagnostic has the following residuals in three equally sized predictor ranges:

Predictor rangeResiduals
Low1.5, 1.75, 2.25, 2.5
Middle-5, -4.5, -3.5, -3
High0, 1, 3, 4

Calculate the centers. The low mean is \(8/4=2\). The middle mean is \(-16/4=-4\), and the high mean is \(8/4=2\). As in the first example, the sequence \(2,-4,2\) shows a curved mean pattern.

Calculate the spreads. The deviations in the low group are \(-0.5,-0.25,0.25,0.5\), giving \(s=\sqrt{(0.25+0.0625+0.0625+0.25)/3}=\sqrt{0.625/3}=0.4564\). In the middle group the deviations are \(-1,-0.5,0.5,1\), giving \(s=\sqrt{2.5/3}=0.9129\). In the high group they are \(-2,-1,1,2\), giving \(s=\sqrt{10/3}=1.826\). Both the center pattern and the spread change. A diagnosis that reported only curvature or only unequal spread would omit an important feature of the plot.

What the Patterns Do—and Do Not—Establish

A mean-pattern error suggests that the model’s conditional average is not adequately represented over the observed range. That does not, by itself, identify the right revision. A smooth residual curve may motivate checking the mean structure, but the plot alone does not establish which particular term or explanation is appropriate. Similarly, a fan-shaped residual cloud suggests unequal conditional variance, but it does not identify why variability changes.

It is useful to state the diagnosis in separate, concrete terms. For example: “The residual smooth bends below zero in the middle and above zero at both ends, while the vertical width appears roughly stable.” Or: “The smooth stays close to zero, but the residual band widens as fitted values increase.” Such descriptions say what the plot shows without claiming more than it can support.

A residual spread can look different when observations are sparse in one part of the predictor range, and extreme residuals can make a group’s standard deviation large. Check the point cloud, not just a summary, and note how much data support each region. A smooth line can also be affected by its settings and by sparse data near the boundaries. These limitations make the plot a diagnostic tool, not a mechanical decision rule.

Common Mistake: Calling Every Fan a Mean Trend

A frequent error is to see residuals that fan outward and conclude that the fitted mean must be wrong. That conclusion confuses width with center. If the residuals remain balanced around zero while their vertical dispersion increases, the visible feature concerns spread. The reverse mistake is also possible: calling a systematic curve in the residual centers “heteroscedasticity” when the cloud’s width is fairly stable. Examine the middle and the width separately before naming the pattern.

Key takeaway: A residual plot has two diagnostic dimensions. A systematic change in the residual center points to a possible conditional-mean mismatch; a systematic change in vertical dispersion points to possible unequal variance. Check each dimension on its own, and report both when both are present.

Check Your Understanding

For each question, distinguish the evidence about the residual center from the evidence about vertical spread.

  1. A residual smooth rises steadily from negative to positive values, while the vertical width looks similar throughout. Which feature is changing, and what does it suggest?
  2. Residuals remain centered near zero, but their vertical band becomes wider as fitted values increase. What pattern is suggested, and what is not suggested by the flat center alone?
  3. In three equal-sized bins, residual means are \(1,-2,1\). What feature of the conditional mean might this pattern indicate? Why should spread still be examined separately?
  4. Why does subtracting a fitted value relate residual location to a mean discrepancy, but leave the variance unchanged in the idealized conditional calculation?
  5. A plot shows both a curved smooth and a widening band. Give a concise diagnosis that accounts for both features without claiming that the plot proves their cause.