Year 11 Standard · Unit 4 Sampling and relationships in data · Lesson 5 of 6

When is a prediction from a line of best fit worth trusting?

A line of best fit will give a number for any x you give it. This lesson asks when that number deserves belief, and what you would need to know before you trust it.

Statistics and ProbabilityGDC optional

Warm-up

Three quick ones from earlier work. Try each in your head or on paper before you open the answer.

  1. From Year 9: a line is y = 4x + 7. What is y when x = 5?
    Answer27, because 4 × 5 + 7 = 27.
  2. From Year 9: the mean point of a data set is (3, 18). What is the mean of the y values?
    Answer18.
  3. From Lesson 4: a survey has a bias. Does a bigger sample reduce it?
    AnswerNo. A bigger sample shrinks the random wobble, but a lean stays.
Words used in this lesson
interpolation
predicting a value from x inside the range of the data. For example: reading a value between two measured days.
extrapolation
predicting a value from x outside the range of the data. For example: extending a line past the last measured day.
line of best fit
a line that follows the trend of a scatter graph and passes through the mean point. For example: the line drawn through the dots.
prediction
a value worked out from the line for a chosen x. For example: the height the line gives for a certain week.
margin
the room for error either side of a prediction. For example: the largest gap from the line in the data.

How tall in week 20?

A garden club measures a bean seedling every week for 8 weeks. The dots rise in a fairly straight band and the club draws a line of best fit, y = 4x + 3, where x is the week and y is the height in centimetres. The line passes through the mean point (4.5, 21). A member wants to use it to say how tall the plant will be in week 20.

Predict first: at which week does the line stop being a sensible guide? What would you need to know about the plant to decide? Test it with the first figure, then use the second to see what the scatter of the dots adds.

5
23height the line gives, in cm
inside the datainside or outside the measured weeks

Week 5: the line gives 23 cm. This is inside the data, so it is interpolation and a reasonable prediction.

Show me the steps
  1. Week 5 is inside the measured weeks, 1 to 8: the line gives 4 × 5 + 3 = 23 cm. This is interpolation, a reasonable prediction.
  2. Week 10 is outside the data: the line gives 43 cm. This is extrapolation. The later measurement is 40 cm, 3 cm below the line, so the line is still fairly close.
  3. Week 16 is well outside the data: the line gives 67 cm, but the later measurement is 47 cm. The plant is levelling off and the line does not know it.
  4. Week 20: the line gives 83 cm and the plant is 48 cm. The further outside the data, the less the line can be trusted.

A line is only as good as the data it came from.

  • Interpolation is predicting for an x inside the range of the data. It is usually reasonable.
  • Extrapolation is predicting for an x outside that range. It assumes the pattern continues, so the further out, the less it can be trusted.
  • Closer dots give a more reliable prediction: the gaps from the line show how far a real value can stray.
  • Ask whether the real situation can continue: a quantity that has a limit cannot keep following the line.
  • Use the line to predict y from x.
5
23value the line gives
22 to 24range the scatter allows

Tight dots, x = 5: the line gives 23. The largest gap in the data is 1: the dots themselves stray this far, so expect about 22 to 24.

Show me the steps
  1. Tight dots, x = 5: the line gives 23 and the largest gap in the data is 1, so the range is 22 to 24.
  2. Loose dots, x = 5: the line still gives 23, but the largest gap is 6, so the range is 17 to 29.
  3. Loose dots, x = 10: the line gives 43 and the range is 37 to 49. This is outside the data (x from 1 to 8), so the band is optimistic and the prediction should be treated with care.
  4. A line through tight dots is more informative than the same line through loose dots, and neither is safe far outside the data.

“Reasonable” does not mean “certain”. Even inside the data a prediction has a margin, and it is wider when the dots are loose. And the line has no memory of what it came from: it will give a number for x = 1000 without any complaint. The judgment about whether to believe the number is yours.

Worked examples

Daily sales of cold drinks are modelled by y = 6x + 40, where x is the day's top temperature in °C. The data covered days from 18 °C to 32 °C. Predict sales at 25 °C and at 45 °C, and comment.

  1. At 25 °C: 6 × 25 + 40 = 190. 25 is inside 18 to 32, so this is interpolation and reasonable.
  2. At 45 °C: 6 × 45 + 40 = 310. 45 is outside the data, so this is extrapolation.
  3. It is also doubtful for a reason outside the numbers: at extreme heat people may stay indoors, so sales could fall.

For a line of best fit the largest gap between any dot and the line is 3. The line gives 40 at x = 12, which is inside the data. Give a range.

  1. The data's own scatter reaches 3 above and below the line.
  2. The dots themselves stray this far, so expect about 40 − 3 to 40 + 3, that is 37 to 43.
  3. This is a rough band. A value at an x outside the data would need a wider one.

Your go. The first step is given. A line of best fit is y = 2.5x + 8, built from data with x from 2 to 10. Predict y at x = 7 and at x = 16, and say which is more reliable.

  1. x = 7 is between 2 and 10, so it is inside the data.
  2. Work out both values, then compare where each x lies.
Check the answer

At x = 7: 2.5 × 7 + 8 = 25.5, interpolation. At x = 16: 2.5 × 16 + 8 = 48, which is 6 beyond the data, extrapolation and less reliable. A common slip is to say both are fine because the line fits the data well: a good fit says nothing about where the data stops.

With a GDC (optional)

Enter the x values and y values as two lists, draw a scatter plot, and use the linear regression command (often in the stats or calc menu) to get a line. It will give a gradient and an intercept, and many models give r as well. The line may differ a little from one drawn by eye through the mean point; both are acceptable if they follow the dots.

The calculator will happily give a value for any x. It does not warn you when x is outside the data, so say in a sentence whether each prediction is inside or outside. Everything here can be done by hand.

Check before you go on

1. A line of best fit is built from data on cars aged 2 to 9 years. For which age is a prediction an extrapolation?

Your turn

Start at Level 1 and go as far as you can. Type negative numbers with a minus sign, for example -7. A wrong answer gets a reason, not just a cross: read it, then try again.

Level 1 · Getting started

2. A line of best fit is y = 3.2x + 15. Predict y when x = 12. Give your answer to one decimal place.

3. A line of best fit has gradient 5 and passes through the mean point (6, 40). The line is y = 5x + c. What is c?

Level 2 · Building

4. A line of best fit is y = 90 − 1.5x, built from data with x from 18 to 34. Predict y at x = 30.

5. The line y = 90 − 1.5x was built from data with x from 18 to 34. Someone uses it at x = 50. What is the strongest reason to doubt that prediction?

Level 3 · Stretch

6. A prediction from a line of best fit is 62, inside the data. The largest gap between any dot and the line was 4. What is the highest value the scatter of the data allows at this x?

7. A town's population, in thousands, was measured for 10 years and fitted by y = 2.4x + 31, where x is years since the first measurement. A planner says that in 80 years the population will be 223 thousand. Which comment is best?

Something to think about

A line of best fit for a runner's 10 km times over six months gives a time that falls by about 30 seconds each month. A friend uses it to say the runner will be faster than the world record in two years. What is wrong, and what could you say instead?

One way to think about it

The line was fitted to six months of data, and two years is far outside it. Improvement slows as a runner approaches a limit, so the trend will not stay straight. A fair statement is that the line is fine for the next month or two and says very little about much later.

Exit ticket

8. Two lines of best fit both give y = 50 at x = 6, which is inside each data set. In data set P the largest gap between a dot and its line is 2; in data set Q it is 9. Which statement is best?