01 / 21

Residuals &
Model Fit

Learn how residuals measure the gap between data and predictions, and how to judge whether a linear model truly fits your data.

AP Statistics

What Is a Residual?

When you fit a line to data, the line won't pass through every point. A residual is the vertical distance between an actual data point and the value predicted by the line of best fit.

A positive residual means the point is above the line. A negative residual means the point is below the line. A residual of zero means the point sits exactly on the line.

Visualizing Residuals on a Scatter Plot

\(x\)
\(y\)
\(-40\)
\(+20\)
\(-30\)
\(+20\)
\(-10\)
Best-fit line Residual (dashed)

Why Residuals Matter

Check the Model
Residuals reveal whether a linear model is appropriate or if another model type would fit better.
Spot Outliers
Unusually large residuals flag data points that may be errors or special cases worth investigating.
Improve Predictions
Analyzing patterns in residuals helps you refine your model for more accurate future predictions.

Residuals are the key diagnostic tool: if your model is good, residuals should be small and show no pattern.

The Residual Formula

\( e > 0 \)
Model under-predicts: the actual point is above the line.
\( e = 0 \)
Perfect prediction: the point lies exactly on the line.
\( e < 0 \)
Model over-predicts: the actual point is below the line.

The Residual Plot

A residual plot graphs the residuals on the \( y \)-axis against the \( x \)-values (or predicted values) on the \( x \)-axis. It is the primary tool for assessing model fit.

\(x\)
\(0\)
\(+\)
\(-\)
Good Fit: Random Scatter

Good vs. Bad Residual Plots

Random Scatter
Points spread evenly above and below zero with no visible pattern. The linear model is a good fit.
Curved Pattern
A U-shape or arch suggests the data is not linear: a quadratic or other model would fit better.
Good: Random Bad: Curved Pattern

Residual vs. Error

Residual \( e \) True Error \( \varepsilon \)
Definition \( y - \hat{y} \) \( y - f(x) \)
Based on Sample regression line True (unknown) relationship
Observable? Yes: we can calculate it No: we never know the true model
Used for Diagnosing model fit Theoretical analysis

How to Analyze Residuals

1
Find the line of best fit using the equation \( \hat{y} = a + bx \).
2
Calculate each residual: \( e = y - \hat{y} \) for every data point.
3
Plot the residuals with \( x \) on the horizontal axis and \( e \) on the vertical axis.
4
Look for patterns. Random scatter means the linear model is appropriate. A curve or fan means it is not.
5
Check residual magnitudes. Large residuals may indicate outliers or poor model fit.

Example 1: Computing a Residual

A student collects data on hours studied (\( x \)) and test scores (\( y \)). The line of best fit is \( \hat{y} = 52 + 6x \). If a student who studied 5 hours scored 88, what is the residual?

1
Find the predicted value: \( \hat{y} = 52 + 6(5) = 52 + 30 = 82 \)
2
Compute the residual: \( e = y - \hat{y} = 88 - 82 = 6 \)
3
Interpret: The residual is +6, so the student scored 6 points above the prediction. The model under-predicted for this student.

Example 2: Reading a Residual Plot

A researcher fits a linear model to data on plant height over time and creates this residual plot. Is the linear model appropriate?

Time (days)
\(0\)

Example 3: Multiple Residuals

Given the regression line \( \hat{y} = 10 + 3x \), calculate each residual:

\( x \) \( y \) (actual) \( \hat{y} \) (predicted) Residual \( e \)
1 15 13 +2
2 14 16 -2
3 20 19 +1
4 21 22 -1
5 25 25 0

A Key Property: Sum of Residuals

This happens because the least-squares line is chosen to minimize the total squared distance. As a side effect, the positive residuals exactly balance the negative residuals.

Assessing Model Fit

1
Residual plot pattern: Random scatter = good. Curve or fan = bad.
2
Residual magnitude: Small residuals relative to the data values indicate a tight fit.
3
Outliers: One or two very large residuals might be outliers rather than evidence of a bad model.

Common Mistakes

✕ Reversed Subtraction
Writing \( \hat{y} - y \) instead of \( y - \hat{y} \). The sign of the residual matters: it tells you whether the model over- or under-predicts.
✕ Ignoring Patterns
Saying "the model fits well" because residuals are small, without checking the residual plot for curves or fanning.
✕ Zero Sum Fallacy
Concluding the model is good because residuals sum to zero. They always do for least-squares: it does not prove good fit.

Summary of Residual Analysis

What to Check Good Sign Warning Sign
Residual plot pattern Random scatter around \( e = 0 \) Curve, arch, or fan shape
Residual size Small relative to \( y \)-values Consistently large residuals
Outliers None, or few and explainable Many extreme residuals
Spread (variance) Roughly constant across \( x \) Widening or narrowing (fanning)

Question 1 of 5

A regression line predicts \( \hat{y} = 45 \) for a data point whose actual value is \( y = 52 \). What is the residual?

Question 2 of 5

A residual plot shows a clear curved pattern (e.g., a U-shape or an arch). What does this indicate?

Question 3 of 5

The line of best fit is \( \hat{y} = 20 + 4x \). For the point \( (3, 29) \), the residual is:

Question 4 of 5

Which of the following is always true for a least-squares regression line?

Question 5 of 5

A data point has a residual of \( 0 \). What does this mean?