☰ Year plan · Statistics

Using the regression line

Week 5 · Using the regression line: predicting y, the error of a prediction, extrapolation and regression from given sums · 3 lessons
1

A full worked regression: the sums, b and a, the line, a prediction and the error at a known point

Statistics Sec 3 Term 1, Unit 1, Lesson 2
GoalCarry out a complete regression: the sums, b and a, the line, a prediction and the error at a known point.
New words
prediction · the value of ŷ that the line gives for a chosen xerror of a prediction · |observed y − ŷ| at a known pointinterpolation · predicting for an x inside the range of the data
Explanation

A farm records, for eight date palms, the irrigation water per month x (in cubic metres) and the dates harvested y (in kg). The five sums are in the table: n = 8, Σx = 43, Σy = 290, Σxy = 1777, Σx² = 277. First b = (nΣxy − Σx·Σy) ÷ (nΣx² − (Σx)²) = (8 × 1777 − 43 × 290) ÷ (8 × 277 − 43²) = 1746 ÷ 367 = 4.7575. Then a = (Σy − bΣx) ÷ n = (290 − 4.7575 × 43) ÷ 8 = 10.678. The regression line of y on x is ŷ = 10.678 + 4.7575x: each extra cubic metre of water adds about 4.76 kg of dates. To predict, replace x in the line. To find the error at a point we already know, subtract: error = |observed y − ŷ|. Keep the unrounded b in your calculator while you work, and round only the final answer; this is why two people may differ in the last decimal. The picture shows the eight dots and the line.

Water x (m³)Dates y (kg)xyx²y²
221424441
326789676
324729576
535175251225
636216361296
747329492209
844352641936
957513813249
Σx = 43Σy = 290Σxy = 1777Σx² = 277Σy² = 11608
Worked examples
xy12345678910112040600
Prediction inside the range. With 4 m³ of water: ŷ = 10.678 + 4.7575 × 4 = 29.71 kg. The values of x in the data run from 2 to 9, and 4 is inside this range, so the prediction is reliable.
Error at a known point. The palm with x = 7 m³ gave y = 47 kg. The line gives ŷ = 10.678 + 4.7575 × 7 = 43.98 kg, so the error is |47 − 43.98| = 3.02 kg. The dot is above the line.
A check. The means are x̄ = 43 ÷ 8 = 5.375 and ȳ = 290 ÷ 8 = 36.25, and the line at x̄ gives 10.678 + 4.7575 × 5.375 = 36.25: it passes through (x̄, ȳ), so b and a are probably right. The sign of b is positive, like the sign of r (which is 0.9736).
Class activity

Using the line ŷ = 10.678 + 4.7575x find the predicted harvest for 3 m³ and for 8 m³ of water. Then compare the 8 m³ prediction with the real palm in the table that received 8 m³ (44 kg) and give the error.

Practice
1
Predict the harvest for 5 m³ of water with the line ŷ = 10.678 + 4.7575x.
2
The palm that got 8 m³ gave 44 kg. Find ŷ and the error.
3
What does b = 4.7575 mean in this story?
4
The line is ŷ = 10.678 + 4.7575x. Why can a palm that received 0 m³ of water not be predicted with it?
5
The two palms with x = 3 gave 26 and 24 kg. Find ŷ at x = 3 and both errors.