Tutorials › Regression Analysis (Undergraduate) › Residual Plots for Unequal Variance

Unequal Variance and Robust Uncertainty · Tutorial 522 of 991

Residual Plots for Unequal Variance

Learn to assess changing residual spread while checking whether curvature or an isolated point provides a better explanation.

Advanced 10 min read

What You'll Learn

  • Define fitted values and residuals for a linear regression.
  • Read residual-versus-fitted plots for signs of changing spread.
  • Use residual-versus-predictor plots to locate where spread changes.
  • Distinguish a funnel-shaped pattern from curvature and an isolated outlier.
  • Explain why residual plots provide evidence, not proof, of unequal variance.

Why Plot Residuals When Spread May Change?

A fitted regression line describes the mean response, but it does not tell us whether individual responses vary around that mean by a similar amount at every level of the predictors. If that variability grows or shrinks, a plot of residuals can make the change visible. The key is to look at the vertical spread of residuals across the plot, not just whether points lie above or below zero.

A widening band can be evidence of unequal variance, but it is not the only explanation for a changing-looking pattern. Curvature in the mean relationship, one unusual observation, or features of how the sample was collected can also affect what the plot looks like. A careful diagnosis checks these alternatives before describing a pattern as evidence of unequal variance.

The Model and the Diagnostic Plots

For clarity, consider a simple linear regression with predictor \(x_i\) and response \(y_i\), for observations \(i=1,\ldots,n\). The mean model is \(y_i=\beta_0+\beta_1x_i+\varepsilon_i\), where the errors have conditional mean zero. For this diagnostic, we allow their conditional variances to differ: \(\operatorname{Var}(\varepsilon_i\mid x_i)=\sigma_i^2\). Assume observations are independent, so their errors are uncorrelated. Constant variance is not assumed; assessing whether the spread appears to change is the point of these plots.

The fitted value is the response predicted by the least-squares line, \(\hat{y}_i=b_0+b_1x_i\). The residual is the observed response minus its fitted value, \(e_i=y_i-\hat{y}_i\). A residual estimates the unobserved error \(\varepsilon_i\), but it is not that error. The least-squares coefficients \(b_0\) and \(b_1\) are calculated from the same observations whose residuals are plotted.

Definition: A residual-versus-fitted plot places \(e_i\) vertically against \(\hat{y}_i\) horizontally. A residual-versus-predictor plot places \(e_i\) vertically against a predictor, such as \(x_i\). In either plot, the diagnostic question for unequal variance is whether the vertical spread around zero changes systematically across the horizontal axis.

A residual-versus-fitted plot is a natural first view: fitted values index the model's predicted response level. A residual-versus-predictor plot can help identify which predictor values are associated with changing spread. In simple regression, fitted values are a linear function of \(x_i\), so the two plots have the same horizontal ordering (or the reverse ordering if the fitted slope is negative). With several predictors, a residual-versus-fitted plot may not reveal which predictor is related to the spread; plotting residuals against each predictor can add useful detail.

Look for a roughly centered band whose width changes, such as a narrow band at small fitted values that widens at large fitted values. This is often called a funnel or fan pattern. Also inspect the pattern of the residuals' signs and their central tendency: a curved trend in the residuals can indicate that the fitted mean relationship is not adequately linear, rather than a pure change in variance. These visual cues are not formal tests and do not prove that the conditional variance changes.

Why Residual Spread Is Only an Approximation

Residuals are constrained by the fitted regression. For example, in a regression with an intercept their sum is zero, and they cannot vary freely like the unobserved errors. This matters because a residual plot is a diagnostic view of estimated errors, not a direct plot of the errors themselves.

A short derivation shows why residual variation need not match error variation point for point. Write the regression in matrix form as \(y=X\beta+\varepsilon\), where the columns of \(X\) contain the intercept and predictor values. Let \(H=X(X^\mathsf{T}X)^{-1}X^\mathsf{T}\) be the projection matrix for least squares, and let \(M=I-H\). Since \(HX=X\), the residual vector is \(e=My=M\varepsilon\). If \(\Omega=\operatorname{Var}(\varepsilon\mid X)\), then

$$ \operatorname{Var}(e\mid X)=M\Omega M^\mathsf{T}. $$

For independent errors, \(\Omega\) is diagonal with entries \(\sigma_j^2\). Since \(M\) is symmetric, the variance of residual \(e_i\) is therefore

$$ \operatorname{Var}(e_i\mid X)=\sum_{j=1}^{n}m_{ij}^{\,2}\sigma_j^2. $$

Each residual's variability can depend on several errors and the regression's projection, not just on the variance of the error at that observation. This is one reason to interpret an apparent funnel as evidence to investigate, rather than as a precise measurement of the error variance at every fitted value.

Worked Example: A Widening Band in Residuals

Suppose a hypothetical regression relates a measurement \(y\), in units, to a predictor \(x\). The fitted line is \(\hat{y}=10+2x\). The table gives the observed values, fitted values, and residuals. Each residual is calculated as \(e_i=y_i-\hat{y}_i\).

\(x_i\)\(y_i\)\(\hat{y}_i=10+2x_i\)\(e_i=y_i-\hat{y}_i\)
112.2120.2
213.614-0.4
316.3160.3
417.018-1.0
521.7201.7
621.222-0.8

For instance, when \(x=5\), the fitted value is \(10+2(5)=20\), so the residual is \(21.7-20=1.7\) units. At \(x=1,2,3\), the residuals are \(0.2,-0.4,0.3\), with absolute values \(0.2,0.4,0.3\). At \(x=4,5,6\), they are \(-1.0,1.7,-0.8\), with absolute values \(1.0,1.7,0.8\).

The residuals are relatively close to zero at the lower fitted values and more spread out at the higher fitted values. A residual-versus-fitted plot would therefore suggest a widening band; because the fitted values rise with \(x\), a residual-versus-predictor plot would show the same ordering here. The pattern is a clue to changing spread, not a conclusion established by six points. The small sample gives little basis for deciding whether the difference reflects a persistent variance pattern or ordinary sampling variation.

Separate Changing Spread from Curvature

Before interpreting a fan-shaped appearance as unequal variance, check whether residuals have a systematic trend in their location. A curved sequence of positive and negative residuals points to a possible mismatch in the mean model. The following hypothetical data illustrate the distinction.

Worked Example: A U-Shape Is Not Just a Funnel

Suppose the fitted line for a response measured in units is \(\hat{y}=10+3x\). The residuals below are calculated from the stated observations.

\(x_i\)\(y_i\)\(\hat{y}_i\)\(e_i=y_i-\hat{y}_i\)
-2642
-167-1
0810-2
11213-1
218162

For \(x=-2\), \(e=6-4=2\); for \(x=0\), \(e=8-10=-2\); and for \(x=2\), \(e=18-16=2\). The residuals are positive at both ends and negative in the middle. That orderly U-shaped sequence is evidence of curvature in the residual pattern. The absolute residuals also happen to be larger at the ends than in the middle, but the sign pattern indicates that changing mean shape is an important alternative explanation. A spread diagnosis should not ignore it.

The residual plot alone does not determine the right mean model. It does indicate that describing this particular pattern only as a widening variance would leave a systematic feature unexplained. Consider the location pattern and the vertical spread together.

Recognize the Influence of an Isolated Point

A single large residual can stretch the vertical scale and make the rest of the points look artificially compressed. That visual effect is different from a broad, systematic increase in spread across the horizontal axis. Look for whether many points support the change in width or whether one observation dominates it.

Worked Example: One Large Residual or a General Fan?

Consider this hypothetical fit, \(\hat{y}=30+2x\), for a response measured in units.

\(x_i\)\(\hat{y}_i\)\(e_i\)\(y_i=\hat{y}_i+e_i\)
-226-125
-128-127
030434
132-131
234-133

At \(x=0\), the fitted value is \(30+2(0)=30\), and the residual is \(34-30=4\) units. The other four residuals are all \(-1\) unit. In a plot, the point at fitted value 30 would stand apart vertically, but the other points do not show a progressive widening from left to right. This is evidence of an isolated residual, not by itself a general funnel pattern. Investigate whether the observation is accurate and whether it has a substantive explanation; an unusual residual is not automatic grounds for deletion.

A Careful Reading Process

A disciplined reading helps keep mean patterns, isolated points, and changes in spread separate. It also makes a diagnostic report clearer: describe what the plot shows and how strongly it supports an interpretation.

1
Check the center.
Ask whether residuals are roughly arranged around zero or show a systematic curve or other location pattern.
2
Compare the width.
Look across fitted values for a consistent widening, narrowing, or other change in vertical spread, rather than relying on one large residual.
3
Use predictor plots for context.
Inspect residuals against individual predictors when the question is whether spread changes with a particular predictor.
4
State the strength of the evidence.
Describe a visual pattern as suggestive or clear in the observed plot, while recognizing that a residual plot alone does not prove unequal error variance.

Common Mistakes

  • Calling every large residual a variance pattern. One isolated point is not the same as a sustained change in spread across fitted values or predictor values. Check whether multiple observations support the pattern.
  • Calling a U-shape a funnel. A systematic sequence of positive and negative residuals suggests a location pattern such as curvature. Check the signs and center as well as the width.
  • Treating residuals as the unobserved errors. Residuals are calculated after fitting and are constrained by the regression. Use them as diagnostic estimates, not as direct observations of each error.
  • Declaring unequal variance proven by a plot. A visible fan is evidence worth reporting, but plots are affected by sample size, individual observations, and the fitted mean model. Describe what is visible without claiming more than the evidence supports.
Key takeaway: In residual-versus-fitted and residual-versus-predictor plots, judge the vertical spread across the horizontal scale while also checking residual location and isolated points. A funnel-like pattern can suggest unequal variance; curvature and outliers are important alternative explanations.

Check Your Understanding

Use the ideas in this tutorial to answer the following questions.

  1. What is plotted on the horizontal and vertical axes of a residual-versus-fitted plot?
  2. A residual plot shows a steady U-shaped sequence of positive, negative, then positive residuals. Why should you check for curvature before describing it as unequal variance?
  3. In a simple linear regression with a positive slope, how are the horizontal orderings in residual-versus-fitted and residual-versus-predictor plots related?
  4. What does one isolated large residual establish about the pattern of error variance across fitted values?
  5. Why are residuals useful indicators of error behavior but not identical to the unobserved errors?