Line of Best Fit
A line of best fit is a straight line drawn through the middle of the points on a scatter plot, often through the mean point \((\bar{x},\bar{y})\). Its equation can be found from two points on it and used to make predictions. In NSW Year 10 Advanced maths you also judge whether a prediction is reliable (NESA outcome MA5‑DAT‑C‑02).
You will read points from a line of best fit, find its equation, and use it to predict values inside the data range (interpolation) and outside it (extrapolation). You will find the mean point, use a calculator to fit a line, and explain what the gradient means, such as the fuel cost per kilometre. Data include eucalyptus heights, foot length and height, July temperatures and elevation, and irrigation at a Bathurst orchard. It is part of Year 10 Advanced Single Variable and Bivariant Statistics.
Theory
A line of best fit (trend line) is a straight line that follows the pattern of a linear scatter plot. Its equation lets you predict one variable from the other, and its gradient and intercept describe the relationship. This Year 10 Advanced maths page covers drawing it by eye through the mean point, finding and interpreting its equation, predicting both ways, judging interpolation and extrapolation, and the least-squares line on a calculator.
A line of best fit is a straight line drawn through a scatter plot with a linear association so that the points are spread evenly either side of it. It need not pass through any data point.
The mean point \((\bar{x}, \bar{y})\) is a good point to draw the line through.
In \(y = mx + c\), the gradient \(m\) is the average change in \(y\) for each increase of \(1\) in \(x\); the intercept \(c\) is the predicted \(y\) when \(x = 0\) (which may or may not make sense).
A prediction inside the range of the data is interpolation; outside it is extrapolation, which is less reliable because the trend may change. The least-squares line is the line of best fit a calculator finds; it always passes through the mean point.
Drawing and using a line of best fit
- Check the scatter plot shows a linear association (a curve needs a different model).
- Find the mean point and mark it.
- Draw a straight line through the mean point following the trend, with about as many points above as below.
- Equation: read two points on the line (or use the mean point and the intercept), find \(m\), then \(c\).
- Interpret \(m\) and \(c\) in words, with units.
- Predict: substitute \(x\) to find \(y\), or substitute \(y\) and solve for \(x\). Say whether it is interpolation or extrapolation.
With a calculator
- Statistics mode, linear regression. Enter the pairs and read \(m\) (or \(a\) or \(b\), depending on the model) and \(c\).
- Round only for the final equation; predictions from the unrounded values are slightly more accurate.
- For years, it is often easier to let \(x\) be the number of years after the first year.
| Age \(x\) (years) | Value \(y\) (\(\$\) thousand) |
|---|---|
| \(1\) | \(30\) |
| \(2\) | \(27\) |
| \(3\) | \(25\) |
| \(4\) | \(21\) |
| \(5\) | \(20\) |
| \(6\) | \(16\) |
| \(7\) | \(15\) |
(i) \(\bar{x} = \dfrac{28}{7} = 4\), \(\bar{y} = \dfrac{154}{7} = 22\). Mean point \(\boldsymbol{(4, 22)}\).
(ii) Through \((0, 33)\) and \((4, 22)\):
| \(m\) | \(=\) | \(\dfrac{22 - 33}{4 - 0} = -2.75\) |
| \(y\) | \(=\) | \(\boldsymbol{-2.75x + 33}\) |
(iii) Gradient: the value falls by about \(\$2750\) for each extra year of age. Intercept: a new car (\(x = 0\)) is worth about \(\$33\,000\).
(iv)
| \(y\) | \(=\) | \(-2.75(5.5) + 33 = 17.875\) |
About \(\boldsymbol{\$17\,900}\). This is interpolation (\(5.5\) is between \(1\) and \(7\)), so it is reasonably reliable.
(i) Find the equation.
(ii) Predict \(B\) after \(3.5\) hours.
(iii) When does the line predict \(10\%\) left? Comment on its reliability.
(i)
| \(m\) | \(=\) | \(\dfrac{40 - 88}{5 - 1} = -12\) |
| \(88\) | \(=\) | \(-12(1) + c \quad\Rightarrow\quad c = 100\) |
| \(B\) | \(=\) | \(\boldsymbol{100 - 12t}\) |
(ii)
| \(B\) | \(=\) | \(100 - 12(3.5) = \boldsymbol{58\%}\) |
(iii) Solve for \(t\):
| \(100 - 12t\) | \(=\) | \(10\) |
| \(12t\) | \(=\) | \(90\) |
| \(t\) | \(=\) | \(\boldsymbol{7.5}~\text{hours}\) |
\(7.5\) hours is beyond the largest value in the data (\(6\) hours), so this is extrapolation and less reliable: batteries often drain faster or slower near empty.
| Practice per day, \(x\) (min) | Typing speed, \(y\) (words/min) |
|---|---|
| \(2\) | \(15\) |
| \(4\) | \(19\) |
| \(6\) | \(26\) |
| \(8\) | \(28\) |
| \(10\) | \(35\) |
| \(12\) | \(38\) |
(i) Use a calculator to find the least-squares line of best fit, with values correct to \(2\) decimal places.
(ii) Predict the speed for \(7\) minutes of practice.
(iii) Comment on a prediction for \(20\) minutes.
(i) Statistics mode, linear regression (\(y = ax + b\) or \(y = mx + c\)). Enter \(x\) and \(y\) as pairs.
| \(m\) | \(=\) | \(2.357\ldots \approx 2.36\) |
| \(c\) | \(=\) | \(10.333\ldots \approx 10.33\) |
| \(y\) | \(=\) | \(\boldsymbol{2.36x + 10.33}\) |
(ii)
| \(y\) | \(=\) | \(2.36(7) + 10.33 = 26.85 \approx \boldsymbol{26.9}~\text{words/min}\) |
(The unrounded line gives \(26.8\); small differences like this come from rounding \(m\) and \(c\).)
(iii) \(x = 20\) is outside the data (\(2\) to \(12\) minutes): extrapolation. The line gives about \(57.5\) words/min, but speed is unlikely to keep rising at the same rate, so treat it with caution.
Find \(\bar{x}\) from the known \(x\)-values, then use the line to get \(\bar{y}\).
| \(\bar{x}\) | \(=\) | \(\dfrac{1 + 2 + 4 + 5 + 8}{5} = 4\) |
| \(\bar{y}\) | \(=\) | \(3(4) + 2 = 14\) |
So the \(y\)-values add to \(5 \times 14 = 70\).
| \(6 + 7 + a + 18 + 25\) | \(=\) | \(70\) |
| \(a\) | \(=\) | \(\boldsymbol{14}\) |
If the unknown is in the \(x\)-values as well, write \(\bar{x}\) and \(\bar{y}\) in terms of it and substitute both into the line.
Common pitfalls
Frequently asked questions
How do you draw a line of best fit?
Find the mean point and draw a straight line through it that follows the trend of the points, with roughly the same number of points above and below the line.
How do you find the equation of a line of best fit?
Choose two points on the line, find the gradient as rise over run, then substitute one point into y equals mx plus c to find c. Use the variable names from the question.
What is the difference between interpolation and extrapolation?
Interpolation predicts within the range of the data and is usually reliable. Extrapolation predicts outside that range and is less reliable, because the pattern may not continue.
What does the gradient of a line of best fit mean?
It is the average change in the y variable for each increase of 1 in the x variable, for example a drop of 2750 dollars in value for each extra year of age.
What is the least-squares line of best fit?
It is the line a calculator finds using linear regression. It fits the points as closely as possible overall and always passes through the mean point.