Week 5 · Using the regression line: predicting y, the error of a prediction, extrapolation and regression from given sums · 3 lessons
3
Regression from given sums, the sign of b and the sign of r, and why predicting outside the data range is risky
Statistics Sec 3 Term 1, Unit 1, Lesson 2
GoalFind r, b and a from given sums, link the sign of b to the sign of r, and see why predicting outside the data is risky.
New words
given sums · n and Σx, Σy, Σxy, Σx², Σy² are told, so we can skip the tableextrapolation · predicting for an x outside the range of the datasame sign · b and r are both positive or both negative
Explanation
When the sums are given, one numerator serves both r and b: nΣxy − Σx·Σy. For r it is divided by √(nΣx² − (Σx)²) × √(nΣy² − (Σy)²), for b by nΣx² − (Σx)² only. The denominators are positive, so the sign of b is always the sign of r. Two cautions follow. (1) A line is built from data in a certain range of x. Inside that range the line is a fair guide; outside it we only guess that the pattern continues, and often it does not. A bean plant grows about 4.3 cm a week for the first five weeks, but the line would give 174.5 cm at week 40, and no bean plant is that tall. (2) A good line shows that y can be predicted from x; it does not show that x causes y. Fan sales rise with temperature, but buying more fans does not make a day hotter.
Worked examples
Sums given: n = 10, Σx = 85, Σy = 387, Σxy = 3790, Σx² = 905, Σy² = 16375 (a delivery fare y in LE against the distance x in km). Numerator 10 × 3790 − 85 × 387 = 5005. Roots: 10 × 905 − 85² = 1825 and 10 × 16375 − 387² = 13981. r = 5005 ÷ √(1825 × 13981) = 5005 ÷ 5051.27 = 0.9908. b = 5005 ÷ 1825 = 2.7425, a = (387 − 2.7425 × 85) ÷ 10 = 15.389. The line is ŷ = 15.389 + 2.7425x.
A negative case: n = 6, Σx = 42, Σy = 340, Σxy = 2108, Σx² = 364, Σy² = 20334 (minutes x since a cup of tea was poured, temperature y in °C). Numerator 6 × 2108 − 42 × 340 = −1632, so both r and b are negative: b = −1632 ÷ 420 = −3.8857, a = (340 + 3.8857 × 42) ÷ 6 = 83.867, r = −1632 ÷ √(420 × 6404) = −0.9951. The tea loses about 3.89 °C a minute.
Extrapolation. Bean plant heights at weeks 1 to 5 are 7, 11, 15, 20, 24 cm, with line ŷ = 2.5 + 4.3x. At week 3 (inside the data) ŷ = 15.4 cm, a good estimate. At week 40, ŷ = 2.5 + 172 = 174.5 cm, which is absurd. The vertical dashed line in the picture marks the end of our data: to its right the line is only a guess.
Class activity
Find a line from data that you collect for at least five days (for example the minutes you spend on homework against the number of subjects). Predict a day inside your data range and a day far outside it. Explain which prediction you trust more and why.
Practice
1
Find b, a and r for n = 8, Σx = 154, Σy = 429, Σxy = 8683, Σx² = 3182, Σy² = 23859.