The idea, step by step
The least-squares objective
A regression line predicts y from x. Its residuals are observed responses minus predicted responses. Least squares chooses an intercept and slope that minimise the sum of squared vertical residuals, not the sum of shortest perpendicular distances. Squaring prevents positive and negative errors cancelling.
For a line fitted with an intercept, the regression line passes through the point of sample means. Its residuals sum to zero apart from rounding.
Record the full model before using it
State which variable is being predicted, the units and the range of observed predictor values. Keep unrounded coefficients for calculations and round final predictions suitably. A regression can be calculated for nearly any data, but the scatter plot decides whether a linear model is sensible.
Using r and sample standard deviations gives the equivalent rule b=r sy/sx. Be consistent about which standard deviation belongs to the response.
A common trap
Minimise signed residuals because they sum to zero.
Instead: Many bad lines can have cancelling residuals. Least squares minimises the sum of their squares.
See the thinking
Calculate a fitted line
Fit y on x to the supplied table.
| x | y |
|---|---|
| 1 | 3 |
| 2 | 4 |
| 3 | 4 |
| 4 | 6 |
| 5 | 8 |
- Centred-sum calculation gives slope b=1.2.
- Use a=ȳ-bx̄=1.4.
- The fitted equation is ŷ=1.4+1.2x; it passes through (3,5).
Fit from summary statistics
For x̄=10, ȳ=25, sx=4, sy=6 and r=0.8, find the regression line.
- .
- .
- The fitted response is ŷ=13+1.2x.
Check your understanding
Given x̄=4, ȳ=9 and slope b=2, find the intercept.
Show answer
a=1.
Substitute the means: 9=a+2×4.
Your turn
6 questions · 18 marks · Work at your own pace.
Read the questions online
- Find the line from x̄=6, ȳ=20, Sxx=10 and Sxy=25.3 marks
- Given r=-0.6, sx=5, sy=10, x̄=8 and ȳ=30, find the regression line.3 marks
- A candidate line has residuals -2,1,1. Calculate its sum of squared residuals.3 marks
- Two models have residuals A=(-3,0,3) and B=(-2,1,1). Which has the smaller least-squares error?3 marks
- A regression line has a=7 and b=0.5. Predict y at x=12.3 marks
- A student rounds b=0.08473 to 0.1 before predicting at x=900. Explain the risk.3 marks
Read the worked solutions
Equivalent correct methods earn the corresponding marks. Include units where asked.
- Find the line from x̄=6, ȳ=20, Sxx=10 and Sxy=25.3 marks
b=25/10=2.5.
a=20-2.5×6=5.
ŷ=5+2.5x. - Given r=-0.6, sx=5, sy=10, x̄=8 and ȳ=30, find the regression line.3 marks
b=-0.6×10/5=-1.2.
a=30-(-1.2×8)=39.6.
ŷ=39.6-1.2x. - A candidate line has residuals -2,1,1. Calculate its sum of squared residuals.3 marks
Square each residual: 4,1,1.
Add the squares, not their signed values.
6. - Two models have residuals A=(-3,0,3) and B=(-2,1,1). Which has the smaller least-squares error?3 marks
A has squared sum 9+0+9=18.
B has 4+1+1=6, so B is better on this criterion.
B. - A regression line has a=7 and b=0.5. Predict y at x=12.3 marks
Substitute x=12 into ŷ=7+0.5x.
7+6=13.
13. - A student rounds b=0.08473 to 0.1 before predicting at x=900. Explain the risk.3 marks
A small coefficient rounding can become large after multiplication by x.
Keep guard digits until the final prediction.
The slope contribution changes from 76.257 to 90, an error of 13.743.
Curriculum reference & lesson scope
SACE Board of South Australia
Stage 2 General Mathematics: statistical models. Original lessons and assessment practice; not an official SACE assessment.
Official curriculum source ↗