Drawing and Using a Line of Best Fit

A line of best fit is a straight line drawn through a scatter graph to show the overall trend. It lets you describe the pattern in one equation and estimate values you didn’t measure.

246810405060708090
The line of best fit through the revision data. The orange diamond is the mean point (5.5, 64.6), and the line passes through it. Example data.

Drawing a line of best fit by eye

  1. Find the mean point. Work out the mean of the x values and the mean of the y values, and mark the point (x̄, ȳ). A good line of best fit passes through it.
  2. Follow the trend. Use a ruler to draw a straight line through the mean point in the direction the points go.
  3. Balance the points. Aim for roughly the same number of points above the line as below it, spread along its length.
  4. Extend it across the data, but no further than you need.

Common mistakes:

  • Joining the dots. A line of best fit is one straight line, not a zigzag from point to point.
  • Forcing it through the origin. Only pass through (0, 0) if the pattern really does.
  • Letting an outlier pull the line. Ignore a point that clearly doesn’t fit the pattern.

For the revision data, the mean point is x̄ = 55 ÷ 10 = 5.5 hours and ȳ = 646 ÷ 10 = 64.6 marks.

Finding the equation of the line

A line of best fit is just a straight line, so you find its equation the same way as any other line: pick two points on the line (not data points), far apart, and use the slope formula.

Example

The line of best fit above passes through about (0, 37) and (10, 87).

Slope: m = (87 − 37) ÷ (10 − 0) = 50 ÷ 10 = 5.

It crosses the y-axis at 37, so the equation is y = 5x + 37.

The slope means each extra hour of revision goes with about 5 more marks. The calculated least squares line is y = 4.96x + 37.3, very close to this estimate.

Making predictions

Interpolation

Predict the score for a student who revises for 6.5 hours.

y = 5 × 6.5 + 37 = 69.5, so about 70 marks.

6.5 hours is inside the range of the data (1 to 10 hours). Predicting inside the data is called interpolation, and it is usually reliable.

Extrapolation

Predict the score for a student who revises for 15 hours.

y = 5 × 15 + 37 = 112 marks. But the test is out of 100, so this is impossible.

15 hours is outside the data. Predicting outside the data is called extrapolation. The pattern may not continue, so extrapolated predictions are unreliable.

Try these predictions in the Line of Best Fit calculator →

When not to use a line of best fit

  • When there is little or no correlation: the line wouldn’t represent the data.
  • When the pattern is curved: a straight line is the wrong shape.
  • For predictions far outside the data, as in the extrapolation example.

Drawing by eye gives slightly different lines for different people. To get one exact line that everyone agrees on, use the least squares regression line.