Resources For Teachers For Tutors For Students & Parents AI New Books Pricing
Year 12 General (Unit 3 & 4) Bivariate data analysis 2

Residual plots

20 practice questions 0 video lessons Theory + worked examples

Learn to build and read residual plots for Year 12 General Mathematics in Queensland (QCAA). A least-squares line can be drawn through any scatterplot, but that does not make it a good model. Downloads of a new app, for example, can climb faster and faster, and a straight line will miss that curve even when \(r\) looks strong.

You will calculate each residual as actual minus predicted, explain what a positive or negative residual says about a point, and plot the residuals against \(x\). Random scatter around zero means a linear model fits; a curve or other pattern means it does not. Next, you will interpret the slope and intercept of a line that passes this test.

Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

A residual plot shows how far each point sits above or below a least-squares line. This guide for Year 12 General Mathematics in Queensland shows how to calculate residuals, construct the plot, and use the pattern to decide whether a linear model is appropriate.

When a least-squares line \(y = mx + c\) is fitted to data, each data point has a predicted value (from the line) and an actual value (from the data). The residual is the difference: actual value minus predicted value.

A positive residual means the point lies above the line, so the line under-predicted. A negative residual means the point lies below the line, so the line over-predicted. A residual of zero means the point is on the line. For a least-squares line, the residuals always add to zero.

A residual plot graphs each residual (vertical axis) against the explanatory variable \(x\) (horizontal axis), with a horizontal line at zero. It shows whether a straight line is a good model for the data. A single residual much larger in size than all the others marks a possible outlier: the point furthest from the line.

Key idea. If the residuals are randomly scattered above and below zero with no pattern, a linear model is appropriate. If they form a clear pattern, such as a curve, a linear model is not appropriate, even when \(r\) is close to \(1\).
Residual plot with no patternEight residuals scattered randomly above and below the dashed zero line with no pattern, so a linear model is appropriate. x residual 1 2 3 4 5 6 7 8 -3 -2 -1 0 1 2 3
No pattern: the residuals bounce randomly above and below zero, so a linear model suits the data.
Residual plot with a curved patternEight residuals forming a U-shaped curve: positive at both ends and negative in the middle, so a linear model is not appropriate. x residual 1 2 3 4 5 6 7 8 -6 -3 0 3 6 9
Curved pattern: positive at both ends and negative in the middle. The data are curved, so a straight line is not a good model.

The residual for each data point:

\[\text{residual} = \text{actual value} - \text{predicted value}\]
residual=actual value-predicted value

The predicted value comes from substituting \(x\) into the least-squares line:

\[\text{predicted value} = mx + c\]
predicted value=mx+c

For a least-squares line, the residuals always balance out:

\[\text{sum of the residuals} = 0\]
sum of the residuals=0
Rearranged. If you know a residual, the actual value is \(\text{actual} = \text{predicted} + \text{residual}\).

Constructing and reading a residual plot

  1. Predict. Substitute each \(x\)-value into \(y = mx + c\) to get the predicted value.
  2. Subtract. Residual \(=\) actual \(-\) predicted. Keep the sign. As a check, the residuals should add to zero (or very close, after rounding).
  3. Plot. Put \(x\) on the horizontal axis and the residual on the vertical axis. Draw the zero line.
  4. Judge. Random scatter with no pattern means a linear model is appropriate. A curve or other clear pattern means it is not.
Example 1 β€” One residual
For a Cairns reef-tour boat, the least-squares line relating the number of passengers, \(x\), to the fuel used on a trip, \(y\) (litres), is \(y = 0.6x + 14\). On one trip with \(40\) passengers, \(36.5\) L of fuel was used. Find the residual for this trip and explain what it means.
Solution

Find the predicted value from the line, then subtract it from the actual value.

\(\text{predicted}\)\(=\)\(0.6 \times 40 + 14\)
\(\text{predicted}\)\(=\)\(24 + 14\)
\(\text{predicted}\)\(=\)\(38 \text{ L}\)
\(\text{residual}\)\(=\)\(\text{actual} - \text{predicted}\)
\(\text{residual}\)\(=\)\(36.5 - 38\)
\(\text{residual}\)\(=\)\(-1.5 \text{ L}\)
residual=-1.5

The residual is \(-1.5\) L. It is negative, so this point lies below the line: the line over-predicted the fuel used by \(1.5\) L.

Example 2 β€” Construct a residual plot
A Gold Coast swim school recorded the number of lessons, \(x\), and the 25 m freestyle time, \(y\) (seconds), for six students. The least-squares line is \(y = -1.5x + 40\). Find the residuals, construct a residual plot and decide whether a linear model is appropriate.
Lessons, \(x\)24681012
Time, \(y\) (s)35.53532.5272621
Solution

For each \(x\), the predicted time is \(-1.5x + 40\). Then residual \(=\) actual \(-\) predicted:

\(x\)actualpredictedresidual
\(2\)\(35.5\)\(37\)\(-1.5\)
\(4\)\(35\)\(34\)\(1\)
\(6\)\(32.5\)\(31\)\(1.5\)
\(8\)\(27\)\(28\)\(-1\)
\(10\)\(26\)\(25\)\(1\)
\(12\)\(21\)\(22\)\(-1\)
\(\text{sum of residuals}\)\(=\)\((-1.5) + 1 + 1.5 + (-1) + 1 + (-1)\)
\(\text{sum of residuals}\)\(=\)\(0\)
sum of residuals=0
Example 2 residual plotResiduals -1.5, 1, 1.5, -1, 1, -1 plotted against lessons 2 to 12, scattered randomly about zero. lessons residual 2 4 6 8 10 12 -2 -1 0 1 2

The residuals are scattered randomly above and below zero with no pattern, so a linear model is appropriate.

Example 3 β€” A strong r but a curved pattern
A Brisbane developer recorded weekly downloads of a new app. The least-squares line is \(y = 3.14x - 3\) (coefficients to 2 decimal places) and \(r = 0.96\). Use a residual plot to decide whether a linear model is appropriate.
Week, \(x\)123456
Downloads, \(y\) (thousand)23581218
Solution

Predicted \(= 3.14x - 3\). Then residual \(=\) actual \(-\) predicted:

\(x\)actualpredictedresidual
\(1\)\(2\)\(0.14\)\(1.86\)
\(2\)\(3\)\(3.28\)\(-0.28\)
\(3\)\(5\)\(6.42\)\(-1.42\)
\(4\)\(8\)\(9.56\)\(-1.56\)
\(5\)\(12\)\(12.7\)\(-0.7\)
\(6\)\(18\)\(15.84\)\(2.16\)
residual=actual-predicted
Example 3 residual plotResiduals 1.86, -0.28, -1.42, -1.56, -0.7, 2.16 against week 1 to 6, forming a U shape. week residual 1 2 3 4 5 6 -2 -1 0 1 2 3

The residuals are positive, then negative, then positive again: a clear U-shaped pattern. A linear model is not appropriate, even though \(r = 0.96\) is strong. The downloads are growing faster each week, so the data are curved.

Example 4 β€” Using the residuals
A least-squares line \(y = 1.2x + 5\) was fitted to five data points. Four of the residuals are \(1.3\), \(-0.8\), \(2.1\) and \(-1.9\).
(a) Find the fifth residual.
(b) The fifth point has \(x = 15\). Find its actual \(y\)-value.
Solution

(a) Least-squares residuals add to zero. (b) Rearrange: actual \(=\) predicted \(+\) residual.

\(1.3 + (-0.8) + 2.1 + (-1.9) + r\)\(=\)\(0\)
\(0.7 + r\)\(=\)\(0\)
\(r\)\(=\)\(-0.7\)
\(\text{predicted}\)\(=\)\(1.2 \times 15 + 5\)
\(\text{predicted}\)\(=\)\(23\)
\(\text{actual}\)\(=\)\(23 + (-0.7)\)
\(\text{actual}\)\(=\)\(22.3\)
actual=22.3

(a) The fifth residual is \(-0.7\). (b) The actual value is \(y = 22.3\), just below the line.

Common pitfalls

Subtract the right way round. A residual is actual minus predicted. Doing predicted minus actual flips every sign, which puts points on the wrong side of the zero line.
A strong \(r\) is not enough. Curved data can still give \(r\) close to \(1\). Only the residual plot shows whether the form is really linear.
Plot against \(x\), not \(y\). The horizontal axis of a residual plot is the explanatory variable. Watch for a missing zero line, which makes the pattern hard to judge.

Frequently asked questions

What is a residual in statistics?

A residual is the actual value of the response variable minus the value predicted by the least-squares line. Positive means the point is above the line; negative means it is below.

How do you construct a residual plot?

Work out the predicted value for each x using y = mx + c, subtract it from the actual y-value to get the residual, then plot each residual against its x-value with a horizontal line at zero.

What does a good residual plot look like?

The residuals are scattered randomly above and below the zero line, with no curve, trend or other pattern. That shows a linear model is appropriate for the data.

What does a curved pattern in a residual plot mean?

It means the relationship between the variables is not linear, so a straight line is not an appropriate model, even if the correlation coefficient is strong.

Why do the residuals add up to zero?

The least-squares line passes through the mean point and balances the points above it against the points below it, so the positive and negative residuals always cancel out.

Can r be close to 1 when a linear model is not appropriate?

Yes. Curved data that rise steadily can give r above 0.9. The residual plot, not r, tells you whether the form of the data is linear.