01 / 20

Residual Plots
and Model Fit

Learn how residual plots reveal whether a linear model truly captures the pattern in your data, or if something more complex is at play.

College Statistics

What is a Residual?

A residual is the difference between an observed value and the value predicted by your regression model. It measures how far off the model's prediction is for each data point.

Positive Residual
Data point is above the regression line: \( y_i > \hat{y}_i \)
Negative Residual
Data point is below the regression line: \( y_i < \hat{y}_i \)

Visualizing Residuals on a Scatterplot

x y e < 0 e > 0
\( \hat{y} = a + bx \)

Why Do Residuals Matter?

A regression line always minimizes \( \sum e_i^2 \), but that doesn't guarantee the linear model is appropriate. Residuals are the diagnostic tool that tells you whether your model's assumptions hold.

1
Check linearity: Do residuals show a random pattern, or is there a curve hiding in the data?
2
Check equal spread: Is the variability of residuals constant across all \( x \) values?
3
Spot outliers: Are there individual points with unusually large residuals?

The Residual Plot

A residual plot graphs the residuals \( e_i \) on the vertical axis against either the predicted values \( \hat{y}_i \) or the explanatory variable \( x_i \) on the horizontal axis. A horizontal line at \( e = 0 \) serves as the reference.

Horizontal axis
\( x \) or \( \hat{y} \): the predictor or fitted values
Vertical axis
\( e_i = y_i - \hat{y}_i \): the residuals
Reference line
Horizontal line at \( e = 0 \)

Good vs. Bad Residual Plots

✓ Good Fit
x 0
Random scatter around \( e = 0 \). No pattern. Linear model is appropriate.
✕ Bad Fit
x 0
Clear U-shape (curved pattern). A linear model is not appropriate.

Patterns That Signal Problems

Curved Pattern
A U-shape or arch means a nonlinear relationship exists. Consider a quadratic or other nonlinear model.
Fan Shape
Residuals widen (or narrow) as \( x \) increases: non-constant variance (heteroscedasticity).
Clusters / Groups
Distinct groups of residuals may indicate lurking variables or subpopulations in the data.

Residual Plot vs. Scatterplot

Residual Plot Original Scatterplot
Y-axis Residuals \( e_i \) Response variable \( y \)
X-axis \( x \) or \( \hat{y} \) Explanatory variable \( x \)
Purpose Check model assumptions Show the relationship
Ideal look Random scatter around 0 Clear trend (linear or other)
Reveals Model deficiencies Association direction/strength

How to Build a Residual Plot

1
Fit the regression model to your data and obtain the equation \( \hat{y} = a + bx \).
2
Compute each predicted value \( \hat{y}_i \) by plugging each \( x_i \) into the equation.
3
Calculate each residual: \( e_i = y_i - \hat{y}_i \).
4
Plot the residuals \( e_i \) on the vertical axis against \( x_i \) (or \( \hat{y}_i \)) on the horizontal axis.
5
Draw a horizontal reference line at \( e = 0 \) and examine the pattern.

Example 1: Computing Residuals

A student fits the line \( \hat{y} = 2 + 3x \) to data. Compute the residual for the point \( (4, 17) \).

1
Predicted value: \( \hat{y} = 2 + 3(4) = 14 \)
2
Observed value: \( y = 17 \)
3
Residual: \( e = 17 - 14 = 3 \)

Example 2: Full Residual Plot

Given \( \hat{y} = 10 + 2x \) and data points, we compute residuals and plot them:

\( x \) \( y \) (observed) \( \hat{y} \) (predicted) \( e = y - \hat{y} \)
11312+1
21514+1
31416-2
41918+1
51920-1

Example 3: Detecting Nonlinearity

A researcher fits a linear model to data that actually follows a quadratic trend. The residual plot reveals the problem:

x
\( e = 0 \)
pattern!

Recognizing a Fan Shape

x
\( e = 0 \)

\( r^2 \) Alone is Not Enough

A high \( r^2 \) value does not guarantee a good model. The famous Anscombe's Quartet shows four very different datasets that all have the same regression line and the same \( r^2 \approx 0.67 \).

\( r^2 \) tells you
How much variance is explained by the linear model (proportion of total variation).
Residual plot tells you
Whether the linear model is the right choice in the first place.

Common Mistakes

✕ Ignoring the residual plot
Relying only on \( r^2 \) or the correlation coefficient \( r \) to judge model fit without examining residuals.
✕ Confusing residuals with data
Plotting \( y \) vs. \( x \) and calling it a residual plot. The y-axis must be \( e_i = y_i - \hat{y}_i \), not the raw \( y \) values.
✕ Flipping the residual formula
Computing \( \hat{y}_i - y_i \) instead of \( y_i - \hat{y}_i \). This reverses the sign of every residual.

Summary: Reading Residual Plots

Residual Pattern What It Means Action
Random scatter Linear model is appropriate ✓ Keep the model
U-shape / arch Nonlinear relationship Try quadratic model
Fan shape Non-constant variance Transform the data
Clusters Subgroups / lurking variable Investigate groupings
Single extreme point Potential outlier / influential Examine that point

Question 1 of 5

A residual is defined as:

Question 2 of 5

A residual plot shows a clear U-shaped curve. What does this indicate?

Question 3 of 5

Given the regression equation \( \hat{y} = 5 + 2x \), what is the residual for the data point \( (3,\, 14) \)?

Question 4 of 5

A residual plot shows residuals that fan out (become more spread) as \( x \) increases. This pattern is called:

Question 5 of 5

Which of the following is true about a well-fitting linear model?