Bivariate Statistics
Senior 5 · Mathematics
Bivariate Statistics
Lesson 4 of 4
45 min
In lesson 1 each pupil drew a line of best fit by eye, and each line gave a slightly different prediction. Statisticians, economists and agronomists need one line that anyone gets from the same data. The answer, found by Legendre and Gauss around 1805, is the line that makes the squared errors as small as possible: the least-squares regression line. It is how a cooperative predicts its harvest from rainfall, or a school its exam results from mock marks.
Definition
The regression line of on is the line that minimises the sum of the squared vertical distances (residuals) . It is used to predict from :
The regression line of on minimises the squared horizontal distances and is used to predict from :
Important
Why these lines minimise the squares. For a fixed slope , is a quadratic in , smallest when is the mean of the numbers : . So the best line passes through . Then
a quadratic in whose vertex is at .
Properties. Both regression lines pass through the mean point . Their slopes and have the same sign as , and
The two lines coincide when , and the closer is to 1, the smaller the angle between them. , the coefficient of determination, is the fraction of the variation in that the line explains.
Worked example 1: the line of on and a prediction
Find the regression line of on for the revision data, and predict the mark of a pupil who revises 10 hours.
Solution. From lesson 2, , , , . So and
At : marks. The slope says each extra hour of revision goes with about 2.5 more marks, on average.
Worked example 2: predicting needs the other line
Estimate how long a pupil who scored 40 revised.
Solution. To predict , use the line of on : , so , that is . At : hours. (Solving the -on- line for would give : close here because is close to 1, but in general different and not the least-squares estimate.)
Check. , and , the of lesson 3. ✓
Worked example 3: from two lines back to the data
The regression lines of a data set are (of on ) and (of on ). Find , and .
Solution. Both lines pass through the mean point. Substituting: , so , and . Then , and because both slopes are positive.
Worked example 4: when a prediction should not be trusted
Use the line of worked example 1 to predict the mark for 25 hours of revision, and comment.
Solution. , which is impossible for a test out of 50. The data cover 2 to 12 hours; predicting inside that range (interpolation) is reasonable, but far outside it (extrapolation) the straight-line pattern need not continue.
Warning
Tip
Given two regression lines but not told which is which, try both assignments: the right one gives .
ExamSolutions: Regression, Least Squares Method for y on x (about 6 min). A worked example of the regression line found from the column totals, then used for a prediction.
Practice
Questions 1 to 3 are routine; 4 to 6 need more care; 7 asks for a judgement.
Further reading for this unit
Sources and credits