Least squares regression and residualsEdexcel A-Level Further Maths: Revision notes
Section 1
The least squares regression line
The least squares regression line of on is the line that minimises the sum of the squares of the residuals, the vertical distances from the points to the line. is the response variable and the explanatory variable, and the line should be used to predict from (not the other way round). The derivation is not required; you must use the formulae.
Using the line of on to predict from . A different line is needed for that.
Section 2
Calculating the coefficients
The line always passes through . Worked example: , , , , . Then and , so . With and , , so . The gradient is the average change in for each unit increase in ; the intercept is the predicted when , which may not be meaningful.
Compute and separately first and write them down; they also feed the RSS.
Section 3
Residuals
A residual is the difference between an observed value and the value predicted by the line: A positive residual means the point is above the line; a negative residual means it is below. Residuals from a least squares line always sum to zero. Example: for , the observation has , so the residual is .
Subtracting the other way round. Residual is observed minus predicted.
Section 4
Residual sum of squares
The residual sum of squares is the quantity that least squares minimises: A small RSS relative to means the line fits well. Example: , , gives . Because it is a sum of squares, RSS is never negative; the formula's second term can never exceed .
Section 5
Checking the fit and outliers
Use residuals to judge whether a linear model is reasonable. If they are small and show no pattern (a mixture of positive and negative), a linear fit is sensible. A run of positive then negative then positive residuals suggests curvature, so a different model may be needed. One residual much larger than the rest marks a possible outlier. To refine a model, investigate the outlier. If there is a reason (a misreading, a recording error), remove it and recalculate the line and RSS. Example: removing a point with residual from seven points cut the RSS from to . Do not remove a point only because it spoils the fit.
In a comment, name the residual and the change in RSS, then link them to the model.
Section 6
Using and interpreting the line
Predicting for an inside the data range is interpolation and is usually reliable. Predicting outside the range is extrapolation and may be wildly wrong, because the relationship may not stay linear. Always interpret the gradient in context: 'for each extra hour of revision the score increases by marks, on average'. Check that predictions make sense (for example, a test score over the maximum is impossible).
That's the notes covered.
Carry on to the next subtopic.
Exam questions on Least squares regression and residuals
- A researcher models the relationship between a variable and a variable using the least squares regression line of on , . Summary statistics from the data give , , and .One observation is , . Calculate the residual for this observation.2 marks
- A student records the number of hours, , spent revising and the score, , out of 40, on a test for 5 students: , , , , . The summary statistics are , , , , and .The regression line is . Interpret the value in context, and explain why the line should not be used to predict the score of a student who revises for 15 hours.2 marks
- A café owner records the midday temperature, C, and the number of cold drinks sold, , on six days: , , , , , . The summary statistics are , , , , and .Find the equation of the regression line of on .3 marks
Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).