Correlation and regression line problems: predictions and residuals
A regression line is the best straight line through a scatter of points; the correlation coefficient r, from −1 to 1, measures how close the points lie to a line.
Key ideas
Regression line: ŷ = a + bx, with b = Sxy ÷ Sxx and a = ȳ − b x̄.
From r: b = r × (σy ÷ σx).
Residual = actual y − predicted y.
r = Sxy ÷ √(Sxx × Syy).
Spearman: rs = 1 − 6Σd² ÷ (n(n² − 1)), with d the difference in ranks.
Watch out: The regression line always passes through the point of means (x̄, ȳ).
Practise this step
5 questions from this step only, in 8 minutes: new numbers and
stories every time, of exactly the types worked out below. Marked at the end, with every question
worked out.
6 types of question. Try each one yourself before you open
the hint or the solution.
Example 1 · level 7
A kiosk's daily ice-cream sales y follow the line y = −33 + 6t, where t is the temperature in °C. On a day of 27 °C the kiosk sold 96 ice creams. What is the residual for that day?
Hint
The residual is the actual value minus the value the line predicts. It is negative when the point lies below the line.
Worked solution
Predicted: −33 + (6 × 27) = −33 + 162 = 129
Actual: 96
Residual: 96 − 129 = −33
Answer: −33 ice creams
Example 2 · level 8
For a class, the mean revision time was 5.5 hours and the mean test score 72. The regression line of score on revision time crosses the score axis at 50. What score does the line predict for 5 hours of revision?
Hint
The regression line always passes through the point of the two means.
Worked solution
Slope: (72 − 50)/5.5 = 22/5.5 = 4
The line: y = 50 + 4x
Prediction: 50 + (4 × 5) = 50 + 20 = 70
Answer: 70 points
Example 3 · level 10
For the heights x and arm spans y of a group of people, the sum of the squared deviations of x from its mean is 64, that of y is 100, and the sum of the products of the deviations is 56. What is the correlation coefficient r?
Hint
r is the sum of the products divided by the square root of the product of the two sums of squares.
Worked solution
64 × 100 = 6400
√6400 = 80
r = 56/80 = 0.7
Answer: 0.7
Example 4 · level 10
A shop tried 10 different prices for a drink. For the prices x (in euros) and the numbers sold y, the sum of the x's is 90, the sum of the y's is 360, the sum of the products xy is 3275 and the sum of the squares of x is 830. What number of sales does the least-squares line predict at a price of 7 euros?
Hint
The slope is (n·Σxy − Σx·Σy)/(n·Σx² − (Σx)²), and the line passes through the two means.
Worked solution
Slope: 350/200 = 1.75
Means: x̄ = 90/10 = 9 and ȳ = 360/10 = 36
Prediction: 36 + (1.75 × (−2)) = 36 − 3.5 = 32.5
Answer: 32.5 drinks
Example 5 · level 10
On many days a café recorded the highest temperature and the number of cold drinks it sold. The temperature has a mean of 15 °C and a standard deviation of 2 °C; the number of cold drinks sold has a mean of 200 and a standard deviation of 30. The correlation between them is 0.15. How many cold drinks does the regression line of sales on temperature predict for a day of 19 °C?
Hint
The slope of the regression line is r times the standard deviation of y divided by that of x, and the line passes through the two means.
Worked solution
Slope: 0.15 × 30/2 = 2.25
19 is 4 from the mean, so the sales are 2.25 × 4 = 9 from their mean
Prediction: 200 + 9 = 209
Answer: 209 drinks
Example 6 · level 10
Two judges ranked the same five cakes, A to E. The first judge gave them the ranks 2, 3, 5, 1 and 4 and the second judge the ranks 5, 2, 1, 4 and 3, in that order. What is Spearman's rank correlation between the two judges?
Hint
For each cake, square the difference d of its two ranks. Then r = 1 − 6Σd²/(n(n² − 1)) with n = 5.
Worked solution
Squared differences, A to E: 9, 1, 16, 9 and 1, together 36
n(n² − 1) = 5 × 24 = 120, and 6 × 36 = 216
r = 1 − 216/120 = −0.8
Answer: −0.8
Ready for the quiz?
Check yourself on this step: 5 questions, 8 minutes.