Lesson 5 of 7 · 18 min
Residuals and residual plots
Calculate residuals, construct a residual plot, and use its pattern to decide whether a linear model is appropriate — even when r is close to 1.
What you will be able to do
- Calculate a residual as the actual value minus the predicted value.
- Construct a residual plot against the explanatory variable.
- Use a residual plot to assess whether fitting a linear model is appropriate.
A driving instructor in Cairns measures the stopping distance of a car at eight speeds. The correlation coefficient is — about as strong as an association gets. Is a straight line the right model?
Look closely at the line. The points at the ends sit above it and the points in the middle sit below it. That pattern is the clue, and a residual plot makes it impossible to miss.
Despite , the residuals go positive, negative, then positive again. The data curves upward, and a straight line can't follow it.
Definition
Residual
- A positive residual: the point is above the line (the model under-predicts).
- A negative residual: the point is below the line (the model over-predicts).
- A residual of 0: the point is on the line.
The residuals of a least-squares line always add to 0. The residual rule is not in the formula book.
Worked example
Calculate and interpret a residual
For the café data, the least-squares line is
On a 30 °C day the café sold 82 iced coffees. Calculate the residual for this day and explain what it tells you.
Step 1: Find the predicted value
Step 2: Subtract predicted from actual
Residual is always actual minus predicted, so a point above the line has a positive residual.
Step 3: Interpret
The residual is positive, so the point is above the line: the café sold about 7 more iced coffees than the model predicted.
Try it yourself first, then check the working one step at a time.
Answer
The residual is 6.96: the café sold about 7 more iced coffees than predicted, so the point lies above the line.
Method
Substitute the explanatory value to find the predicted value.
Residual = actual − predicted.
Positive: above the line (under-predicted). Negative: below (over-predicted).
Watch out for
Calculating predicted − actual, which gives .
Using , find the residual for the day when the temperature was 25 °C and the café sold 55 iced coffees.
A residual plot graphs each residual against its value of the explanatory variable. It flattens the least-squares line onto the horizontal axis, so any pattern in how the points miss the line is easy to see.
Constructing a residual plot
Fit the least-squares line
Use technology on the raw data.
Find each predicted value
Substitute every value into the line.
Calculate each residual
Actual predicted, for every point. A spreadsheet does this in one column:
=B2-(slope*A2+intercept).Plot residuals against the explanatory variable
Explanatory variable on the horizontal axis, residual on the vertical axis, with a horizontal line at 0.
Café data: the residuals are randomly scattered around 0 with no pattern, so a linear model is appropriate.
Stopping distances: the residuals form a clear U-shaped curve, so a linear model is not appropriate, even though .
Key idea
Reading a residual plot
- Random scatter around 0 with no pattern: a linear model is appropriate.
- A clear pattern — a curve (U shape or upside-down U), or residuals that fan out: a linear model is not appropriate. The association is non-linear, so another model would fit better.
Don't over-read a few points: you are looking for a clear, systematic pattern.
A residual plot shows the residuals forming a clear upside-down U shape: negative at both ends and positive in the middle. What should you conclude?
Worked example
Use a residual plot to judge a linear model
Stopping distances for a car at eight speeds are shown.
| Speed (km/h) | 40 | 50 | 60 | 70 | 80 | 90 | 100 | 110 |
|---|---|---|---|---|---|---|---|---|
| Stopping distance (m) | 26 | 35 | 45 | 57 | 70 | 84 | 99 | 116 |
Technology gives and the least-squares line .
a) Calculate the residuals at 40, 70 and 110 km/h.
b) The residual plot is shown in the lesson. Use it to decide whether a linear model is appropriate.
Step 1: Residual at 40 km/h
Predicted: . Residual: .
Step 2: Residual at 70 km/h
Predicted: . Residual: .
Step 3: Residual at 110 km/h
Predicted: . Residual: .
Keep four decimal places in the slope here: rounding it to 1.29 changes the prediction at 110 km/h by almost half a metre.
Step 4: Describe the residual plot
All eight residuals are 4.50, 0.64, , , , , 0.36, 4.50: positive, then negative, then positive. They form a clear U-shaped pattern.
Step 5: Conclude
Because the residual plot has a clear curved pattern, the association is non-linear and a linear model is not appropriate, even though .
Braking distance grows with the square of speed, so stopping distance curves upward.
Try it yourself first, then check the working one step at a time.
Answer
The residuals are 4.50, and 4.50. The residual plot shows a clear U-shaped pattern, so a linear model is not appropriate despite .
Method
Find each predicted value from the line, then actual − predicted.
Plot residuals against the explanatory variable.
Describe the pattern (random or curved), then conclude whether a linear model is appropriate.
Watch out for
Concluding the model is appropriate because is close to 1.
Describing the pattern without drawing the conclusion, or the reverse.
Common mistake
High r is not proof of a linear association
measures how closely points follow a straight line, and points on a gentle curve can still be very close to one. The stopping distances have and a clearly curved residual plot. When the question gives you a residual plot, base your decision about linearity on it, not on .
A least-squares line predicts a stopping distance of 60.07 m at 70 km/h. The residual at 70 km/h is m. What was the actual stopping distance?
Exam tip
Two parts to every answer
Describe the residual plot and draw the conclusion: "The residual plot shows a clear curved (U-shaped) pattern, so a linear model is not appropriate for this data." Saying only "it's curved" or only "linear isn't appropriate" usually earns one of the two marks.
Summary
Residual = actual − predicted. Positive means above the line, negative means below.
A residual plot graphs residuals against the explanatory variable, with a line at 0.
Random scatter: a linear model is appropriate. A clear pattern (such as a curve): it is not.
close to 1 does not guarantee linearity. Check the residual plot.
Finished the lesson?
Try the 3 quick checks above and the lesson completes itself, or mark it complete now.