Least-squares regression (SACE Stage 2 General Mathematics)
“Determine and interpret the least-squares regression line, use it to make predictions, and assess fit using residuals.”
The least-squares regression line is the straight line that minimises the sum of the squared vertical gaps (residuals) between the data and the line. You interpret the slope and intercept in context, then substitute to predict.
Jump to a section
What this dot point is asking
You must find the regression line (usually with a calculator), interpret its slope and intercept, use it to predict, and judge its fit using residuals.
The least-squares line
The least-squares line is written , where is the slope and is the vertical intercept. It is the unique line that makes the total of the squared vertical distances from the points to the line as small as possible.
A residual is the vertical gap between an observed data point and the value the line predicts: . The least-squares line minimises the sum of the squared residuals.
In practice you read and from a calculator, but you must interpret both:
- The slope is the predicted change in for each one-unit increase in .
- The intercept is the predicted value of when .
A regression of weekly sales (thousands of dollars) against advertising spend (hundreds of dollars) gives . Interpret the slope and intercept in context, then predict weekly sales when .
Step 1: Interpret the slope in context
The slope is the predicted change in for each one-unit increase in . Because is measured in hundreds of dollars and in thousands of dollars, a one-unit rise in represents an extra of advertising. So the slope tells us that each additional spent on advertising is associated with a predicted rise of in weekly sales.
Step 2: Interpret the intercept in context
The intercept is the predicted value of when , that is, when nothing is spent on advertising. This predicts weekly sales of with zero advertising spend. In practice this figure may reflect sales from loyal customers or other channels, though it should be used cautiously if is outside the range of the data.
Step 3: Substitute to make the prediction
To predict sales when (that is, of advertising), substitute into the regression equation. The multiplication comes first, then the addition:
Final answer: Predicted weekly sales are when is spent on advertising.
Prediction, interpolation and extrapolation
Substituting an -value inside the range of the data is interpolation, which is usually reliable. Substituting beyond the data range is extrapolation, which is risky because the linear pattern may not continue.
Predicting within the range of the collected data is interpolation and is generally trustworthy. Predicting outside that range is extrapolation; treat it with caution because there is no evidence the relationship holds there.
Using residuals to assess fit
After fitting the line, residuals tell you how good the fit is. A residual plot graphs each residual against .
- If the residuals are scattered randomly above and below zero with no pattern, a linear model is appropriate.
- If the residual plot shows a clear curve or pattern, the relationship is not really linear and a straight line is the wrong model.
Using the regression line , suppose that at the actual recorded sales were , that is (thousands). Find the residual at this point and explain what it means.
Step 1: Find the predicted value from the regression line
The residual compares what the line predicts against what actually happened. We first calculate what the line says sales should be at by substituting into the equation:
So the model predicts weekly sales of when is spent on advertising.
Step 2: Compute the residual
The residual is defined as the actual value minus the predicted value. Taking the actual minus the predicted preserves the sign: a positive residual means the model underestimated, and a negative residual means it overestimated.
Step 3: Interpret the sign and size of the residual
The residual of (thousands of dollars) is positive, which means the actual sales of were above the value the line predicted. The model underestimated sales at this point. A positive residual places the data point above the regression line on a scatterplot.
Final answer: The residual is (that is, ), indicating actual sales were higher than the line's prediction.
What "least squares" actually minimises
The line is called "least squares" because, among all possible straight lines, it makes the sum of the squared residuals as small as possible. Squaring the residuals serves two purposes: it stops positive and negative gaps from cancelling, and it penalises large misses more heavily than small ones, so the line is pulled toward the bulk of the data. The line always passes through the mean point , which is a useful checkpoint and explains why a single far-off outlier can swing the line noticeably - it drags the squared-distance total up until the line tilts toward it.
Choosing a non-linear model
When a residual plot shows a clear curved pattern, the straight-line model is wrong even if its looks high. SACE often compares a linear fit with an exponential one for growth data such as subscriber numbers or populations. The better model is the one whose residual plot is patternless and whose is closer to . Citing both pieces of evidence - the residual pattern and the value - is what a full-mark justification requires; relying on alone is not enough, because a curved relationship can still produce a deceptively high .
Linking back to correlation
The coefficient of determination from the correlation work tells you the proportion of variation in explained by the line. A high together with a patternless residual plot means the linear model is a strong fit.
Keep full calculator accuracy for and while predicting, and round the final answer to a sensible number of figures. Rounding the coefficients early can throw a prediction off by a noticeable amount.
Do not swap the explanatory and response variables; the regression of on is different from the regression of on . Also do not trust a far extrapolation, and do not call a fit "good" from alone; always check the residual plot for a leftover pattern.
Exam-style questions
Questions in the style of SACE Board 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.
SACE 2022-style2 marksCalculator-assumed. The area of Arctic sea ice ( million km squared) is recorded against the year of observation () from 1980 to 2020. State the equation of the least-squares regression line using the context variables.Show worked answer →
Enter the pairs into a calculator's linear regression. With explanatory and response, the calculator gives approximately slope and intercept .
So (small rounding differences accepted). (1 mark for slope and intercept, 1 mark for using the context variables and rather than and .)
The negative slope reflects the steady decline in sea-ice area over time.
SACE 2023-style2 marksCalculator-assumed. Using the least-squares line for the number of potoroos after months, predict when the population reaches 300, and comment on the reliability.Show worked answer →
Substitute : , so and months. (1 mark)
So about 110 months. This is an extrapolation well beyond the 60-month data range, so it should be treated with caution. (1 mark)
SACE 2021-style2 marksCalculator-assumed. A regression of weekly sales (thousands of dollars) on advertising spend (hundreds of dollars) gives . At the actual sales were 13.5 (thousand dollars). Find the predicted value and the residual.Show worked answer →
Predicted value: (thousand dollars). [1 mark]
Residual (thousand dollars), so the actual sales were 1100 dollars above the line. [1 mark]
A positive residual means the model underestimated this point.