Resources For Teachers For Tutors For Students & Parents AI New Books Pricing
Year 12 Maths - General (Unit 3 & Unit 4) Investigating and modelling linear associations

Residual analysis

20 practice questions 0 video lessons Theory + worked examples

Check whether a straight line really suits your data with residual analysis in Year 12 VCE General Mathematics. A podcast whose audience grows faster every week can still show a high correlation, yet a straight line will miss badly at the start and the end. Residuals, the gaps between the actual and predicted values, reveal this.

You will calculate residuals as actual minus predicted, decide whether each point sits above or below the line, and use the fact that least squares residuals add to zero. Then you will build residual plots and read them: random scatter supports a linear model, while a curve signals that the data may need a transformation.

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

Theory

A residual measures how far each point lies from the least squares line, and a residual plot shows whether a straight line really fits. This Year 12 General Mathematics guide for students in Victoria shows how to calculate residuals, construct the plot and read it to judge a linear model.

When a least squares line \(y = a + bx\) 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 (horizontal axis), with a horizontal line at zero. It is used to check the quality of fit: whether a straight line is a good model for the data.

Key idea. If the residuals are randomly scattered above and below zero with no pattern, a linear model is supported. If they form a clear pattern, such as a curve, the relationship is non-linear and 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} = a + bx\]
predicted value=a+bx

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 value of the explanatory variable into \(y = a + bx\) 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 the explanatory variable on the horizontal axis and the residual on the vertical axis. Draw the zero line.
  4. Judge. Random scatter with no pattern supports a linear model. A curve or other clear pattern means the relationship is non-linear.
Example 1 β€” One residual
For a Phillip Island ferry, the least squares line relating the number of passengers to the fuel used on a crossing (litres) is \(\text{fuel} = 15 + 0.7 \times \text{passengers}\). On one crossing with \(30\) passengers, \(35.4\) L of fuel was used. Find the residual for this crossing and explain what it means.
Solution

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

\(\text{predicted}\)\(=\)\(15 + 0.7 \times 30\)
\(\text{predicted}\)\(=\)\(15 + 21\)
\(\text{predicted}\)\(=\)\(36 \text{ L}\)
\(\text{residual}\)\(=\)\(\text{actual} - \text{predicted}\)
\(\text{residual}\)\(=\)\(35.4 - 36\)
\(\text{residual}\)\(=\)\(-0.6 \text{ L}\)
residual=-0.6

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

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

For each number of lessons, the predicted time is \(42 - 1.5 \times \text{lessons}\). Then residual \(=\) actual \(-\) predicted:

\(x\)actualpredictedresidual
\(2\)\(37.5\)\(39\)\(-1.5\)
\(4\)\(37\)\(36\)\(1\)
\(6\)\(34.5\)\(33\)\(1.5\)
\(8\)\(29\)\(30\)\(-1\)
\(10\)\(28\)\(27\)\(1\)
\(12\)\(23\)\(24\)\(-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 the residual plot supports a linear model.

Example 3 β€” A strong r but a curved pattern
A Bendigo podcast recorded its subscribers (hundreds) for the first six weeks. The least squares line is \(\text{subscribers} = -2 + 3.14 \times \text{week}\) (with \(b\) to \(2\) decimal places) and \(r = 0.96\). Use a residual plot to decide whether a linear model is appropriate.
Week, \(x\)123456
Subscribers, \(y\) (hundreds)34691319
Solution

Predicted \(= -2 + 3.14 \times \text{week}\). Then residual \(=\) actual \(-\) predicted:

\(x\)actualpredictedresidual
\(1\)\(3\)\(1.14\)\(1.86\)
\(2\)\(4\)\(4.28\)\(-0.28\)
\(3\)\(6\)\(7.42\)\(-1.42\)
\(4\)\(9\)\(10.56\)\(-1.56\)
\(5\)\(13\)\(13.7\)\(-0.7\)
\(6\)\(19\)\(16.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. Subscribers are growing faster each week, so the relationship is non-linear.

Example 4 β€” Using the residuals
A least squares line \(y = 6 + 1.4x\) was fitted to five data points. Four of the residuals are \(1.6\), \(-0.9\), \(2.3\) and \(-2.2\).
(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.6 + (-0.9) + 2.3 + (-2.2) + \text{residual}\)\(=\)\(0\)
\(0.8 + \text{residual}\)\(=\)\(0\)
\(\text{residual}\)\(=\)\(-0.8\)
\(\text{predicted}\)\(=\)\(6 + 1.4 \times 15\)
\(\text{predicted}\)\(=\)\(6 + 21\)
\(\text{predicted}\)\(=\)\(27\)
\(\text{actual}\)\(=\)\(27 + (-0.8)\)
\(\text{actual}\)\(=\)\(26.2\)
actual=26.2

(a) The fifth residual is \(-0.8\). (b) The actual value is \(y = 26.2\), 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\) (and \(r^2\)) close to \(1\). Only the residual plot shows whether the form is really linear.
Plot against the explanatory variable. The horizontal axis of a residual plot is \(x\), not \(y\). 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 = a + bx, 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 supports a linear model 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. A transformation may help.

Why do the residuals add up to zero?

The least squares line passes through the point of means 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.