← Data and scatterplots

πŸ“– Line of best fit

The rule

  • A line of best fit is a straight line through the middle of the dots, with about as many dots above as below.
  • You can draw it by eye or use a computer. Two good lines are close, but not always the same.
  • Its equation is y = mx + c. m is the gradient: how much y changes when x goes up by 1. c is the value of y when x = 0.
  • To find m, pick two points on the line, not two dots: m = (yβ‚‚ βˆ’ y₁) Γ· (xβ‚‚ βˆ’ x₁). Then put one point into y = mx + c to find c.
  • To predict, put your x into the equation and work out y.
  • Interpolation predicts inside the range of the data. It is fairly reliable.
  • Extrapolation predicts outside the range. The pattern may not carry on, so it is risky.
  • Tight dots give a trustworthy line. Loose dots give a rougher line and rougher predictions.

Examples

The line is y = 6x + 30 (mark from hours). Predict the mark at 5 hours. β†’ 60

  1. Put x = 5 in.
  2. y = 6 Γ— 5 + 30
  3. y = 30 + 30 = 60

Put x = 5 into the equation. m multiplies x, then c is added.

0123456789100102030405060708090100Hours studiedTest mark

A line passes through (2, 7) and (6, 15). Find its equation. β†’ y = 2x + 3

  1. m = (15 βˆ’ 7) Γ· (6 βˆ’ 2) = 8 Γ· 4 = 2
  2. y = 2x + c. Put in (2, 7): 7 = 2 Γ— 2 + c
  3. 7 = 4 + c, so c = 3
  4. y = 2x + 3

Find m from the two points, then find c from one of them.

01234567802468101214161820xyAB

A car's price ($000) is y = βˆ’2x + 30, where x is its age. Find the price at age 6. β†’ $18 000

  1. Put x = 6 in.
  2. y = βˆ’2 Γ— 6 + 30
  3. y = βˆ’12 + 30 = 18
  4. The price is about $18 000.

Put x = 6 into the equation. A negative gradient means the price falls.

05101520051015202530Age of car (years)Price ($1000)

Same car line. The data covers ages 1 to 10. Predict the price at age 20. Trust it? β†’ βˆ’10, so no: it is impossible

  1. y = βˆ’2 Γ— 20 + 30 = βˆ’10
  2. A price of βˆ’10 is impossible.
  3. Age 20 is beyond the data (ages 1 to 10): extrapolation.
  4. Do not trust it.

Age 20 is outside the data. Extrapolation can give nonsense.

05101520051015202530Age of car (years)Price ($1000)

Watch out

  • β€œThe line must pass through every dot.” No: it balances the dots, some above and some below.
  • β€œAt x = 5, y = 6x + 30 is 6 + 5 + 30.” No: m multiplies x. It is 6 Γ— 5 + 30.
  • β€œPredicting at x = 40 is as reliable as at x = 5.” No: beyond the data, the pattern may not hold.
  • β€œc is where the line meets the x axis.” No: c is where it meets the y axis, at x = 0.
Start the lesson β–Ά