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.
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
Why Residuals Matter
Residuals are the key diagnostic tool: if your model is good, residuals should be small and show no pattern.
The Residual Formula
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.
Good vs. Bad Residual Plots
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
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?
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?
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
Common Mistakes
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?