Residuals
How far did a prediction miss the actual result? Calculate a residual, explain its sign in context, and use residual plots to see what a straight-line model leaves unexplained.
By the end of this lesson, you should be able to:
- Calculate the difference between an observed response and its predicted value.
- Explain whether a model underpredicts or overpredicts, using response units.
- Read and construct residual plots, and use their patterns to assess a linear model.
Before you start: Review linear regression predictions. You should be comfortable substituting an explanatory value into a supplied equation.
First time learning this? Follow the delivery example from the fitted line to its residual plot, then try the worked examples.
Here to revise? Review the sign and pattern checklist, then attempt the practice questions before revealing answers.
The concept in 60 seconds
A residual is the observed response minus the response predicted by the model for the same explanatory value.
Think: actual result first, prediction second. If the model predicts minutes but a delivery takes minutes, its residual is minute.
The sign tells you the direction of the miss. A positive residual means the actual response is above the prediction: the model underpredicts. A negative residual means the actual response is below the prediction: the model overpredicts.
The size tells you how far the prediction missed in the response units. A residual of minute is an overprediction by minute, not a negative delivery time.
Quick check: predicted time is shorter than actual time. What is the sign?
Positive. The actual value is larger, so . The model underpredicts the actual time.
A real situation: how much did the delivery model miss?
Use the same invented deliveries from Topic 5.3. Distance is measured in kilometres; actual time and predicted time are measured in minutes. The supplied fitted line is:
| Delivery ID | Distance (km) | Observed (min) | Predicted (min) | Residual (min) |
|---|---|---|---|---|
| A | ||||
| B | ||||
| C | ||||
| D | ||||
| E | ||||
| F | ||||
| G | ||||
| H | ||||
| I |
The two panels zoom in on deliveries C and D. Circles mark observations, squares mark predictions, and vertical segments show the signed residuals at the same distance.
Delivery C: at , the model predicts minutes and the actual time is minutes. Thus : the model overpredicts by minute.
Delivery D: at , the prediction is minutes and the actual time is minutes. Thus : the model underpredicts by minute.
The residual is a vertical difference at the same distance. It is not the shortest slanted distance to the line, and it is not a difference in kilometres.
Key ideas and notation
Observed response:
The actual response recorded for one individual. It is a measured delivery time in our example.
Predicted response:
The model’s output at that individual’s explanatory value. Keep the hat to distinguish the prediction from the observation.
Residual:
The signed difference . It describes how the model missed this observed response.
Residual magnitude:
The distance above or below the prediction in response units, ignoring direction. Smaller magnitude means a closer prediction for that observation.
Zero reference line
The horizontal line in a residual plot. A point on it represents an observation that the model predicts exactly.
Residual plot
A scatterplot of residuals against explanatory values or predicted responses. It makes patterns in the model’s misses easier to see.
Do not confuse the letters: the residual and correlation measure different things. Correlation summarizes linear association; a residual describes an individual prediction difference.
Calculate and interpret a residual
- Find the actual response. Use the recorded value for the individual.
- Calculate the matching prediction. Substitute that individual’s explanatory value into the supplied model.
- Subtract in the correct order. Calculate actual minus predicted, keeping the sign.
- Explain the result. Name the response, give its units, and state whether the model underpredicts or overpredicts.
Delivery C, step by step
The delivery’s actual time is minute less than predicted, so the model overpredicts its time by minute.
| Residual | Observation relative to line | Model interpretation |
|---|---|---|
| Above the fitted line | Underpredicts the actual response | |
| Below the fitted line | Overpredicts the actual response | |
| On the fitted line | Matches this observed response exactly |
Keep the response units
If the response is time in minutes, residuals are in minutes. If the response is remaining battery charge measured as a percentage, a difference between and is percentage points. It is not a relative percentage error.
Keep enough precision
Calculate the prediction before rounding the residual. If you are given a rounded model, use it as supplied; if technology provides full coefficients, avoid rounding those coefficients early. Small discrepancies can result from using different coefficient precision.
Build a residual plot
To plot residuals against distance, keep each delivery’s distance on the horizontal axis and replace its actual time with its residual on the vertical axis.
Delivery C moves from on the original scatterplot to on the residual plot. Delivery D becomes . Label the axes with variables and units, and draw the horizontal reference line .