Tutorials › Regression Analysis (Undergraduate) › Residuals Versus Fitted Values for Global Structure

Specification Checks and Residual Patterns · Tutorial 569 of 991

Residuals Versus Fitted Values for Global Structure

Use residuals-versus-fitted plots to assess broad patterns across a model’s predictions without mistaking a visual clue for a definitive diagnosis.

Advanced 10 min read

What You'll Learn

  • Define fitted values and residuals for an ordinary least squares regression.
  • Read broad curvature across the range of fitted values as evidence to investigate mean structure.
  • Recognize separated residual patterns as possible group structure.
  • Distinguish changing residual spread from a pattern in the residual mean.
  • Explain why residuals from a model with an intercept have no linear association with fitted values.
  • State what a residual-versus-fitted plot can suggest and what it cannot identify.

Why Plot Residuals Against Fitted Values?

A regression model compresses several predictors into one prediction for each observation. Plotting each residual against that fitted value gives a global view of whether the model’s predictions are missing a broad pattern across their range. A systematic curve, a separation into groups, or a changing spread can be a reason to investigate the model further.

This is a diagnostic display, not a test that certifies a model as correct or names the exact term that should be added. The horizontal axis combines the predictors through the fitted values. A visible pattern can indicate that some part of the model’s mean structure needs attention, while the plot alone may not reveal which predictor, group, or feature is responsible.

Model, Fitted Values, and Residuals

Consider a regression model for a quantitative response with \(n\) observations and \(p\) regression coefficients:

$$ Y_i=\beta_0+\beta_1x_{i1}+\cdots+\beta_{p-1}x_{i,p-1}+\varepsilon_i,\qquad i=1,\ldots,n. $$

Here \(Y_i\) is the response for observation \(i\), \(x_{ij}\) is its value for predictor \(j\), and \(\varepsilon_i\) is the error around the model’s mean. For the usual regression interpretation, the model specifies the conditional mean of \(Y_i\) given the predictors, and the errors have mean zero. The standard constant-variance model also assumes equal error variance across observations; independence is another usual assumption. Normality is not required to draw or visually inspect this plot.

After fitting the model by ordinary least squares (OLS), let \(\hat{Y}_i\) be the fitted value, the model’s predicted response for observation \(i\), and let \(e_i\) be its residual:

Definition: The fitted value is the model’s prediction, \(\hat{Y}_i\). The residual is the observed response minus that prediction, \(e_i=Y_i-\hat{Y}_i\). A positive residual means the observation is above its fitted value; a negative residual means it is below.

A residual-versus-fitted plot places \(\hat{Y}_i\) on the horizontal axis and \(e_i\) on the vertical axis, with a reference line at \(e_i=0\). Each point represents one observation. The plot asks whether residuals are distributed around zero in a reasonably pattern-free way over the range of predictions, and whether their vertical spread changes.

What OLS Guarantees—and What It Does Not

When the fitted regression includes an intercept, the OLS residuals sum to zero and are orthogonal to the fitted values. As a result, a residual-versus-fitted plot cannot show an ordinary linear association between these two quantities in the fitted sample. This algebraic feature does not rule out curvature, separated groups, or changes in spread.

To see why, write the observed response vector as \(Y\), the fitted vector as \(\hat{Y}\), the residual vector as \(e=Y-\hat{Y}\), and the design matrix containing the model’s columns as \(X\). OLS chooses coefficients \(\hat{\beta}\) to minimize the sum of squared residuals. The least-squares normal equations give \(X'e=0\). Because the model includes an intercept, a column of \(X\) is a vector of ones, so the residuals sum to zero. Also, \(\hat{Y}=X\hat{\beta}\), and therefore:

$$ \hat{Y}'e=(X\hat{\beta})'e=\hat{\beta}'X'e=0. $$

Thus the residuals have zero sample covariance with the fitted values. But zero linear association does not mean there is no other relationship: residuals can be positive at both ends and negative in the middle, for example. These guarantees depend on fitting OLS with an intercept; do not assume the same constraints for a model fitted without one.

Worked Example: A Broad Curved Pattern

Suppose a hypothetical OLS fit with an intercept produces the following fitted values and observed responses. Calculate the residuals and describe what the residual-versus-fitted plot suggests.

ObservationFitted value \(\hat{Y}_i\)Observed response \(Y_i\)
11014
22018
33026
44038
55054

For each observation, \(e_i=Y_i-\hat{Y}_i\). The calculations are \(14-10=4\), \(18-20=-2\), \(26-30=-4\), \(38-40=-2\), and \(54-50=4\). The residuals therefore progress from positive to negative and back to positive as the fitted values increase. That U-shaped pattern suggests the fitted mean may miss broad curvature somewhere across the prediction range.

This pattern is consistent with the OLS constraints: \(4-2-4-2+4=0\), and \(10(4)+20(-2)+30(-4)+40(-2)+50(4)=0\). So the residuals sum to zero and have zero linear association with the fitted values, even though the curved pattern is clear. The plot suggests further investigation; by itself, it does not identify which predictor or model feature is responsible.

Reading Broad Structure in the Plot

A useful first reading is to look for a broad pattern in the vertical center of the points as fitted values increase. If points fluctuate around zero without an obvious systematic shape, there is no conspicuous global mean pattern in this display. That is limited reassurance, not proof that the model is correct: a pattern involving a particular predictor can be obscured when all predictors are compressed into fitted values.

A curved sequence of residuals is different from random scatter around zero. It suggests that the average response may depart from the fitted mean in some part of the range. A group pattern can appear as clusters or as groups of points tending to opposite sides of zero at comparable fitted values. That may prompt questions about whether relevant group structure is represented adequately in the model. Neither visual pattern establishes a cause or specifies a remedy.

Also inspect the vertical spread. If residuals remain centered near zero but become more dispersed at larger fitted values, the main visual clue concerns changing variability rather than a clear miss in the mean. Conversely, systematic movement of the residual center above or below zero points toward a possible mean-pattern issue. Real plots can show both kinds of pattern, so the distinction is a guide to interpretation, not a guarantee that only one feature is present.

Worked Example: Opposing Patterns Across Groups

Suppose a hypothetical model produces these observations for two labeled groups, A and B. Calculate the residuals, then compare the group patterns at the same fitted values.

GroupFitted value \(\hat{Y}_i\)Observed response \(Y_i\)
A2023
B2017
A3032
B3028
A4043
B4037

Using \(e_i=Y_i-\hat{Y}_i\), the residuals for group A are \(23-20=3\), \(32-30=2\), and \(43-40=3\). For group B they are \(17-20=-3\), \(28-30=-2\), and \(37-40=-3\). At each fitted value, the two groups lie on opposite sides of zero.

The group mean residuals are \((3+2+3)/3=8/3\approx2.67\) response units for A and \((-3-2-3)/3=-8/3\approx-2.67\) response units for B. If the group labels are known and used to distinguish plot symbols, this consistent separation is a clue that group structure may be relevant to the mean model. If the labels are not displayed, the pattern may look like a wider vertical scatter. The fitted values alone do not explain why the groups differ.

Worked Example: Changing Spread Without a Clear Mean Pattern

In another hypothetical fit, residuals occur in pairs at three fitted values. Calculate the mean residual and root mean square residual in each pair to distinguish the vertical center from the spread.

Fitted value \(\hat{Y}_i\)Residuals at that fitted value
10\(-1,\ 1\)
20\(-2,\ 2\)
30\(-4,\ 4\)

The mean residual at each fitted value is zero: \((-1+1)/2=0\), \((-2+2)/2=0\), and \((-4+4)/2=0\). Thus these pairs do not show a shift in their vertical center. Their root mean square residuals, however, are \(\sqrt{((-1)^2+1^2)/2}=1\), \(\sqrt{((-2)^2+2^2)/2}=2\), and \(\sqrt{((-4)^2+4^2)/2}=4\) response units.

The spread grows across the fitted values even though the paired residual means remain at zero. In a plot, this would suggest changing variability rather than broad curvature in the residual center. It is a reason to examine the constant-variance assumption, not evidence by itself that the mean function is wrong.

A Careful Workflow

Read the plot in a consistent order, and keep the conclusion proportional to what the display shows.

1
Locate zero and the prediction range.
Check which fitted values are represented and whether residuals occur on both sides of the zero reference line.
2
Look for broad movement in the center.
Ask whether residuals trace a curve or show sustained positive or negative tendencies across regions of fitted values.
3
Look for groups and changes in spread.
Use known labels when available to notice separated patterns, and compare the vertical spread across the prediction range.
4
State the evidence and its limits.
Describe the pattern as a clue about global mean structure, group structure, or variability. Do not claim the plot proves a model violation or identifies its source.

Common Mistakes and Why the Plot Matters

A common mistake is to reason that a residual-versus-fitted plot must be uninformative because OLS residuals have zero correlation with fitted values. The correction is that zero correlation rules out only a linear association in the fitted sample when an intercept is present. It does not rule out curvature, separated groups, or a fan-shaped spread.

Another mistake is to treat every increase in vertical spread as evidence that the mean is curved. Instead, distinguish the location of the residuals from their dispersion: a changing center suggests investigating mean structure, while a changing spread suggests investigating variability. A third mistake is to treat a visible pattern as a diagnosis. Fitted values combine predictors, so a global plot can flag structure without pinpointing its source.

The plot matters because a model can produce plausible predictions over much of its range while still showing systematic patterns that an overall summary can hide. A careful description of the pattern helps direct the next question without overstating what visual evidence alone can establish.

Key takeaway: A residual-versus-fitted plot is a global check across the model’s predictions. Look separately at the residual center, group separation, and vertical spread. Treat patterns as evidence to investigate, not as proof of a particular cause.

Check Your Understanding

Answer in context, distinguishing what the plot suggests from what it establishes.

  1. What does a positive residual mean, and how is it calculated from the observed response and fitted value?
  2. Why can residuals have zero linear association with fitted values while still showing a U-shaped pattern?
  3. A plot shows two labeled groups tending to opposite sides of zero at similar fitted values. What might this suggest, and what can the plot not identify by itself?
  4. Residuals are centered near zero across the fitted range, but their vertical spread grows. Which feature of the model is the more direct concern?
  5. Why should a residual-versus-fitted plot be described as a global diagnostic rather than a way to identify which predictor is responsible for a pattern?