Skip to main content

Residual analysis in bivariate data (QCE General Mathematics Unit 3)

Syllabus dot point

“Calculate residuals for a least-squares line, construct a residual plot, and use it to assess the appropriateness of fitting a linear model to the data”

15 min read

Quick answer

A residual is actual minus predicted: positive above the line, negative below, and the residuals of a least-squares line sum to zero. A residual plot graphs residuals against the explanatory variable; random scatter means a linear model is appropriate, while a clear pattern such as a curve means it is not, even when R2R^2 is high. Residuals can also be used backwards (actual == predicted ++ residual) to recover a line or a missing value.

Jump to a section
  1. What this dot point is asking
  2. The answer
  3. Exam-style questions
  4. Practice questions

What this dot point is asking

Fitting a least-squares line is only half the job; the other half is checking whether a straight line was the right model. The QCAA General Mathematics 2025 syllabus (Topic 2, Bivariate data analysis 2) asks you to construct a residual plot and use it to assess the appropriateness of fitting a linear model to the data. That means calculating residuals (the vertical gaps between the data and the line), plotting them against the explanatory variable, and reading the pattern.

Residual questions appear in IA2, the problem-solving and modelling task and the external assessment. They range from one-mark calculations to multi-step problems like the six-mark question below, which is modelled on a QCAA item and works backwards from residuals to recover the line.

The answer

Residuals

For each data point, the least-squares line y=mx+cy = mx + c gives a predicted value. The residual is how far the actual value is from that prediction:

residual=actual y−predicted y.\text{residual} = \text{actual } y - \text{predicted } y.

  • A positive residual: the point is above the line (the model under-predicted).
  • A negative residual: the point is below the line (the model over-predicted).
  • A zero residual: the point is on the line.

For typing speed yy (words per minute) against hours of practice xx, the line is y=3.54x+28.71y = 3.54x + 28.71. A student who practised 3 hours has a predicted speed of 3.54×3+28.71=39.333.54 \times 3 + 28.71 = 39.33; if they actually type 41 words per minute, the residual is 41−39.33=1.6741 - 39.33 = 1.67 words per minute.

Rearrangements are common: actual == predicted ++ residual, and predicted == actual −- residual.

Two properties of least-squares residuals:

  • They always sum to zero (positive and negative residuals balance), so a residual plot always has points on both sides of zero.
  • They are measured in the units of the response variable.

Constructing a residual plot

A residual plot is a scatterplot with:

  • the explanatory variable (xx) on the horizontal axis, and
  • the residual for each point on the vertical axis,

with a horizontal reference line at residual =0= 0 (which represents the least-squares line).

To construct one: calculate the predicted value for each xx, subtract it from the actual yy, then plot each (x, residual) pair. A spreadsheet or calculator speeds this up, but in an examination you may be asked to calculate one or two residuals by hand and plot them.

Reading a residual plot

Key fact

If the residuals are randomly scattered above and below zero with no pattern, a linear model is appropriate. If they show a clear pattern (especially a curve, such as positive, then negative, then positive), the association is non-linear and a linear model is not appropriate, however high R2R^2 is.

The reason is simple: if the true association is a curve, a straight line must cut across it, so it will be too high in some places and too low in others, and the residuals will run in blocks of the same sign. Random errors, on the other hand, jump above and below the line unpredictably.

Residuals from a line fitted to curved dataScatterplot of stopping distance in metres against speed from 20 to 90 kilometres per hour, with points at 6, 11, 18, 25, 34, 43, 54 and 67 metres. The least-squares line d equals 0.864 v minus 15.29 is drawn. Vertical segments show the residuals: the points are above the line at 20 and 90 kilometres per hour and below it from 40 to 70, a curved pattern that shows the association is not linear even though R squared is 0.982.020406020406080speed (km/h)stopping distance (m)abovebelow the lineaboveAbove, below, above: a curved pattern, so a line is not appropriate.

In the stopping-distance data the residuals are +4.0+4.0, +0.4+0.4, −1.3-1.3, −2.9-2.9, −2.6-2.6, −2.2-2.2, +0.1+0.1, +4.5+4.5 (to one decimal place): positive at both ends and negative in the middle. The line has R2=0.982R^2 = 0.982, yet it is the wrong shape. It even predicts a negative stopping distance (−15.3-15.3 m) at a speed of 0, which is impossible.

Compare the typing data (hours 1 to 8; speeds 32, 35, 41, 42, 47, 49, 55, 56). The residuals are −0.25-0.25, −0.79-0.79, 1.681.68, −0.86-0.86, 0.610.61, −0.93-0.93, 1.541.54 and −1.00-1.00: they jump above and below zero with no pattern, so the linear model y=3.5357x+28.7143y = 3.5357x + 28.7143 is appropriate.

Other features of a residual plot

  • An isolated large residual suggests a possible outlier; check the data point and comment on it.
  • A fan shape (residuals getting larger as xx increases) means predictions are less reliable at large xx, even if the pattern is otherwise linear.

Residuals and R2R^2

The coefficient of determination R2R^2 tells you the proportion of the variation in yy explained by the linear model; the residual plot tells you whether the linear model has the right shape. Report both: "R2=0.98R^2 = 0.98, so 98%98\% of the variation in typing speed is explained by practice time, and the residual plot shows random scatter, so the linear model is appropriate."

If a residual plot shows a curve, the syllabus conclusion is that a linear model is not appropriate. Straightening curved data with transformations is not part of the QCAA syllabus (see the data transformation page if you are curious), so in QCAA assessment the expected response is to recognise and explain the non-linearity, and to be cautious about predictions from the line.

Working backwards from residuals

Because residual == actual −- predicted, a residual lets you recover the line or a missing value. Combined with m=rsysxm = r\frac{s_y}{s_x} and the fact that the line passes through (xˉ,yˉ)(\bar{x}, \bar{y}) (so c=yˉ−mxˉc = \bar{y} - m\bar{x}), this allows multi-step questions like the blood pressure problem below: find a predicted value from one residual, use it with the slope to find cc, then use another residual to find an actual value.

Worked examples: residuals, plots and reverse problems

Calculating residuals

The line y=3.5357x+28.7143y = 3.5357x + 28.7143 models typing speed against practice hours. Find the residuals for the students with x=3x = 3 (y=41y = 41) and x=8x = 8 (y=56y = 56).

x=3x = 3. Predicted =3.5357×3+28.7143=39.3214= 3.5357 \times 3 + 28.7143 = 39.3214; residual =41−39.3214≈1.68= 41 - 39.3214 \approx 1.68.

x=8x = 8. Predicted =28.2856+28.7143=56.9999≈57.00= 28.2856 + 28.7143 = 56.9999 \approx 57.00; residual =56−57.00=−1.00= 56 - 57.00 = -1.00.

Marker's note: show the predicted value on its own line before subtracting.

Judging a residual plot

Stopping-distance residuals (in order of speed): +4.0+4.0, +0.4+0.4, −1.3-1.3, −2.9-2.9, −2.6-2.6, −2.2-2.2, +0.1+0.1, +4.5+4.5. Is a linear model appropriate?

Pattern. Two positive, four negative, two positive: a U-shape.

Conclusion. The association between speed and stopping distance is non-linear, so a linear model is not appropriate, despite R2=0.982R^2 = 0.982.

Marker's note: describe the pattern in words ("positive, then negative, then positive"), then state the conclusion.

Finding the line from summary statistics and residuals

r=0.8r = 0.8, sx=5s_x = 5, sy=12s_y = 12, xˉ=20\bar{x} = 20, yˉ=70\bar{y} = 70. Find the line, the residual for (24,83)(24, 83), and the yy-value of the point with x=15x = 15 and residual −4-4.

Line
m=0.8×125=1.92m = 0.8 \times \frac{12}{5} = 1.92; c=70−1.92×20=31.6c = 70 - 1.92 \times 20 = 31.6; y=1.92x+31.6y = 1.92x + 31.6.
Residual
Predicted at 24 is 77.68; residual 83−77.68=5.3283 - 77.68 = 5.32.
Missing yy
Predicted at 15 is 60.4; actual =60.4−4=56.4= 60.4 - 4 = 56.4.

Marker's note: the formula m=rsysxm = r\frac{s_y}{s_x} and c=yˉ−mxˉc = \bar{y} - m\bar{x} are in the QCAA syllabus and are worth memorising.

The problem in brief

A 31-year-old with blood pressure 119 has residual −0.75-0.75; r=0.875r = 0.875, sx=4s_x = 4, sy=6s_y = 6. The 40-year-old has residual 1.4.

Chain. Predicted at 31 =119.75= 119.75; m=1.3125m = 1.3125; c=79.0625c = 79.0625; predicted at 40 =131.5625= 131.5625; actual =131.5625+1.4≈133= 131.5625 + 1.4 \approx 133.

Marker's note: every link in the chain earns a mark, so write each one.

Common traps
Predicted minus actual
A residual is actual minus predicted; reversing it flips every sign.
Plotting residuals against yy
The horizontal axis of a residual plot is the explanatory variable xx.
Trusting a high R2R^2
A curved association can have R2R^2 above 0.95; only the residual plot tests linearity.
Seeing a pattern that is not there
A few residuals of the same sign in a row can happen by chance; look for a clear, systematic shape across the whole plot.
Rounding too early in chained problems
Keep full precision until the final answer.
Predicting outside the data with a poorly fitting line
Extrapolation from a line that is the wrong shape can give impossible answers.
Exam technique

For any residual calculation, write "predicted =…= \ldots" then "residual =actual−predicted=…= \text{actual} - \text{predicted} = \ldots". For "Is a linear model appropriate? Justify" questions, use: "The residual plot shows [random scatter / a clear curved pattern], so a linear model [is / is not] appropriate." In a reverse problem, write the formula residual == actual −- predicted and rearrange it in words before substituting.

Note

A line of best fit makes a guess for every point, and the residual is how far off the guess was: the real value minus the guess. If you plot all those misses and they bounce up and down randomly, the line is doing a fair job. If they make a smile or frown shape, the line is guessing too low at the ends and too high in the middle, which means the data really follows a curve and a straight line is the wrong tool.

Exam-style questions

Questions in the style of QCAA exam questions on this dot point, each with a worked answer. They are written by ExamExplained unless tagged "Past paper"; the year shows the paper a question is modelled on.

Practice6 marks
Researchers gathered data to determine if a model could reliably predict systolic blood pressure given a person's age. One candidate was 31 years old with a systolic blood pressure of 119. For this data the correlation coefficient r is 0.875, the standard deviation for age is 4 and for systolic blood pressure is 6. A residual plot was produced for the model (the residual for the 31-year-old reads -0.75, and the residual for the oldest person, aged 40, reads 1.4). Determine the actual systolic blood pressure, to the nearest whole number, for the oldest person in the sample (40 years old).
Show worked answer →

The key relationship is residual == actual −- predicted, so predicted == actual −- residual and actual == predicted ++ residual.

Step 1: a predicted value from a residual (1 mark). For the 31-year-old: 119−predicted=−0.75119 - \text{predicted} = -0.75, so the predicted value at age 31 is 119.75119.75.

Step 2: slope (1 mark). m=rsysx=0.875×64=1.3125m = r\dfrac{s_y}{s_x} = 0.875 \times \dfrac{6}{4} = 1.3125.

Step 3: yy-intercept (1 mark). The point (31,119.75)(31, 119.75) lies on the line y=mx+cy = mx + c: 119.75=1.3125×31+c119.75 = 1.3125 \times 31 + c, so c=119.75−40.6875=79.0625c = 119.75 - 40.6875 = 79.0625. The model is y=1.3125x+79.0625y = 1.3125x + 79.0625.

Step 4: predicted value at age 40 (1 mark). y=1.3125×40+79.0625=52.5+79.0625=131.5625y = 1.3125 \times 40 + 79.0625 = 52.5 + 79.0625 = 131.5625.

Step 5: add the residual (1 mark). Actual =131.5625+1.4=132.9625= 131.5625 + 1.4 = 132.9625.

Step 6: round and state (1 mark). The oldest person's systolic blood pressure is about 133.

A positive residual means the actual value is above the line. Keep full precision until the final rounding.

Modelled on the QCAA 2021 General Mathematics external assessment (not checked word for word against the paper) (question summarised; the residual plot is described in words).

Practice questions

Original practice questions graded from foundation to exam level, each with a full worked solution. Try them before revealing the solution.

foundation2 marks
A least-squares line is y=3.54x+28.71y = 3.54x + 28.71, where xx is hours of practice and yy is typing speed (words per minute). A student who practised for 3 hours types at 41 words per minute. (a) Find the predicted typing speed. (b) Find the residual and say whether the point lies above or below the line.
Show worked solution →

(a) y=3.54×3+28.71=10.62+28.71=39.33y = 3.54 \times 3 + 28.71 = 10.62 + 28.71 = 39.33 words per minute. (1 mark)

(b) Residual =41−39.33=1.67= 41 - 39.33 = 1.67. It is positive, so the point lies above the line: the student types 1.67 words per minute faster than predicted. (1 mark)

foundation1 mark
A data point has a predicted value of 72.4 and a residual of −3.1-3.1. Find the actual value.
Show worked solution →

Actual == predicted ++ residual =72.4+(−3.1)=69.3= 72.4 + (-3.1) = 69.3. (1 mark)

foundation2 marks
What goes on each axis of a residual plot, and what does the horizontal line through zero represent?
Show worked solution →

The explanatory variable goes on the horizontal axis and the residuals on the vertical axis. (1 mark)

The line residual =0= 0 represents the least-squares line itself: points above it were under-predicted, points below it over-predicted. (1 mark)

core3 marks
Stopping distances (dd m) of a car at speeds (vv km/h) are: (20, 6), (30, 11), (40, 18), (50, 25), (60, 34), (70, 43), (80, 54), (90, 67). The least-squares line is d=0.864v−15.29d = 0.864v - 15.29 with R2=0.982R^2 = 0.982. (a) Find the residuals at 20 km/h and 50 km/h. (b) The residuals, in order of speed, are positive, positive, negative, negative, negative, negative, positive, positive. Is a linear model appropriate? Explain.
Show worked solution →

(a) At 20: predicted 0.864×20−15.29=2.00.864 \times 20 - 15.29 = 2.0; residual 6−2.0=4.06 - 2.0 = 4.0. At 50: predicted 43.2−15.29=27.9143.2 - 15.29 = 27.91; residual 25−27.91=−2.9125 - 27.91 = -2.91. (2 marks)

(b) No. The residuals form a clear curved (U-shaped) pattern, so the association is non-linear: the line over-predicts at middle speeds and under-predicts at low and high speeds. This is true even though R2=0.982R^2 = 0.982 is very high. (1 mark)

core2 marks
For the typing data (hours xx: 1 to 8; speeds 32, 35, 41, 42, 47, 49, 55, 56) and the line y=3.5357x+28.7143y = 3.5357x + 28.7143, the residuals are −0.25-0.25, −0.79-0.79, 1.68, −0.86-0.86, 0.61, −0.93-0.93, 1.54 and −1.00-1.00. (a) Check that they add to about zero. (b) What does the residual plot show?
Show worked solution →

(a) −0.25−0.79+1.68−0.86+0.61−0.93+1.54−1.00=0.00-0.25 - 0.79 + 1.68 - 0.86 + 0.61 - 0.93 + 1.54 - 1.00 = 0.00. (1 mark) The residuals of a least-squares line always sum to zero (here allowing for rounding).

(b) The residuals switch between positive and negative with no pattern: random scatter. The linear model is appropriate. (1 mark)

core2 marks
Explain why a very high coefficient of determination does not by itself show that a linear model is appropriate.
Show worked solution →

R2R^2 measures how much of the variation in the response variable is explained by the linear model; curved data can still lie close to a straight line over a limited range, giving a high R2R^2 (the stopping-distance data has R2=0.982R^2 = 0.982). (1 mark)

Only the residual plot shows whether the errors are random (linear model appropriate) or follow a pattern (model systematically wrong). (1 mark)

exam4 marks
For a data set, r=0.8r = 0.8, sx=5s_x = 5, sy=12s_y = 12, xˉ=20\bar{x} = 20 and yˉ=70\bar{y} = 70. (a) Find the equation of the least-squares line in the form y=mx+cy = mx + c. (b) A data point (24,83)(24, 83) is in the data set. Find its residual. (c) Another data point has x=15x = 15 and residual −4-4. Find its yy-value.
Show worked solution →

(a) m=rsysx=0.8×125=1.92m = r\frac{s_y}{s_x} = 0.8 \times \frac{12}{5} = 1.92; c=yˉ−mxˉ=70−1.92×20=31.6c = \bar{y} - m\bar{x} = 70 - 1.92 \times 20 = 31.6. So y=1.92x+31.6y = 1.92x + 31.6. (2 marks)

(b) Predicted at 24: 1.92×24+31.6=77.681.92 \times 24 + 31.6 = 77.68. Residual =83−77.68=5.32= 83 - 77.68 = 5.32. (1 mark)

(c) Predicted at 15: 1.92×15+31.6=60.41.92 \times 15 + 31.6 = 60.4. Actual =60.4+(−4)=56.4= 60.4 + (-4) = 56.4. (1 mark)

exam3 marks
Using the stopping-distance model d=0.864v−15.29d = 0.864v - 15.29, a student predicts the stopping distance at 10 km/h. (a) Find the prediction. (b) Evaluate the reasonableness of this prediction, referring to the residual plot and to extrapolation.
Show worked solution →

(a) 0.864×10−15.29=−6.650.864 \times 10 - 15.29 = -6.65 m. (1 mark)

(b) The prediction is not reasonable: a stopping distance cannot be negative. (1 mark) It is an extrapolation (10 km/h is below the smallest speed in the data, 20 km/h), and the curved residual plot already showed that the linear model does not fit the shape of the data, so extending it beyond the data is especially unreliable. (1 mark)

Practise this

Sources & how we know this

ExamExplained