Line of Best Fit by Eye
Every question with a fully worked solution.
- Line of Best Fit by Eye - Video - Line of Best Fit Part 1 Watch
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 10A maths page covers drawing it by eye through the mean point, finding and interpreting its equation, predicting both ways, judging interpolation and extrapolation, and deciding when a straight line is not suitable.
Bivariate data records two variables for each person or item, such as height and foot length. The independent (explanatory) variable goes on the horizontal axis and the dependent variable, the one we want to predict, on the vertical axis.
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. A calculator or spreadsheet can also find a line of best fit (the least-squares line); that is covered on the Linear Regression Using Technology page.
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.
Is a straight line suitable?
- Plot the points before drawing any line.
- Curved pattern: if the values rise (or fall) by more and more each step, the association is non-linear, and a straight line of best fit gives poor predictions.
- Separate groups: if the points form two clusters (two types of item), one line through all of them fits neither group. Use a line for each group.
- Outlier: leave an obvious outlier out when you draw the line.
| 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.
| Time, \(t\) (s) | Distance, \(d\) (m) |
|---|---|
| \(0.5\) | \(1.2\) |
| \(1\) | \(4.9\) |
| \(1.5\) | \(11.0\) |
| \(2\) | \(19.6\) |
| \(2.5\) | \(30.6\) |
| \(3\) | \(44.1\) |
(ii) A shop sells coffee beans in two ranges, standard and organic. The table shows the prices.
| Mass (g) | Standard (\(\$\)) | Organic (\(\$\)) |
|---|---|---|
| \(250\) | \(8\) | \(13\) |
| \(500\) | \(14\) | \(23\) |
| \(750\) | \(20\) | \(33\) |
| \(1000\) | \(26\) | \(43\) |
(i) Find the increase in distance for each half-second:
| \(\text{increases}\) | \(:\) | \(3.7,\ 6.1,\ 8.6,\ 11.0,\ 13.5\) |
The distance rises by more each time, so the points curve upwards: a positive, non-linear association. A straight line would sit above the points in the middle and below them at the ends, so it is not suitable for predictions.
(ii) Each range on its own is exactly linear: standard prices rise \(\$6\) and organic prices \(\$10\) for every extra \(250\) g. On a scatter plot they make two separate groups, with the organic points above the standard ones.
One line through all eight points would pass between the groups and fit neither of them. No: draw a separate line for each range, and say which range a prediction is for. The range of coffee is a third variable that splits the data.
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.
When should you not use a straight line of best fit?
When the points curve, or when they form separate groups. A curved pattern is non-linear, so a straight line gives poor predictions. Separate groups, such as two types of product, need a separate line for each group.