Chapter 14 · Statistics and data analysis
Lines of Best Fit: Choose a Line and Judge Its Fit
Learn why a straight line can model paired data, how to pick the line the points stay closest to, and how to judge how well a line fits.
Often you collect two numbers about the same thing. Bivariate data are data made of such pairs: two quantities measured for each person or object. A coach records two numbers for each of 8 players. The first is , the hours the player practiced free throws in one week, from to hours here. The second is , the number of free throws the player then made out of shots, a whole number from to . The 8 pairs are , , , , , , and . In the scatter plot below, the horizontal axis shows hours of practice and the vertical axis shows free throws made. The plot also shows Line A, the line with equation .
Look at the overall shape. As increases, tends to increase, and the points appear to climb along a roughly straight path instead of curving. You will check this with exact numbers below. Along a straight line such as Line A, changes by exactly the same amount for each step of in . Line A's -values at are , so they go up exactly each time. When points follow a roughly straight path, one line with one simple equation can describe the whole trend. That line is a model: a simplified description of the data. A straight line that the points stay close to overall is called a line of best fit. Line A's equation is exact, but its fit to the players is only approximate. Real data scatter around a trend, so most of these points sit a little above or below the line.
To measure how close a point is to a line, use its vertical gap: the point's -value minus the line's -value at the same . You find the line's -value by substituting the point's into the line's equation. A positive gap means the point is above the line, and a negative gap means it is below. A gap of means the point is on the line. The size of a gap is its distance from , so a gap of has size .
Worked example
Find one vertical gap
Line A has equation . One player practiced hours and made free throws, which is the point . What is this point's vertical gap from Line A?
Every point on Line A has a -value equal to . Substitute to find the line's -value at hours.
Subtract the line's value from the data value. Keep this order, data minus line, so that points above the line get positive gaps.
Read the result. The gap is positive, so the point is free throw above the line. The value is exact for Line A, but as a description of this player it is only approximate.
Answer
The point has a vertical gap of , so it lies free throw above Line A.
Many different lines can be drawn through the same scatter plot, so you need a way to decide which one fits best. A classmate suggests Line B, , because it passes exactly through three players' points: , and . Line A passes exactly through only two, and . The figure below shows both lines with the same 8 points. The table after it lists every player's exact vertical gap from each line.
| Hours | Free throws | Gap from Line A: | Gap from Line B: |
|---|---|---|---|
Worked example
Compare two candidate lines
Use the table to decide which candidate, Line A or Line B, is the better line of fit for all 8 players.
One informal way to judge closeness overall is to add the sizes of the gaps. Use sizes, not signed gaps. A point below a line is as far from it as a point above, and signed gaps of and would cancel to and hide both misses. Start with Line A.
Add the sizes of Line B's gaps the same way, so both lines are measured by the same rule. Then compare the totals.
As a second check, compare the largest single miss, which shows the worst a line does for any one player. Line A misses no player by more than free throw. Line B misses the player who practiced hours by .
Look at where Line B misses. Points sit below it on the left, with gaps and , and above it on the right, with gaps , and . This pattern shows that Line B is too flat to follow the climb of the data.
Answer
Line A is the better line of fit. Its gap sizes total free throws and none is more than , while Line B's total and reach , even though Line B passes through more points.
Real data rarely sit exactly on a line, so the real question is how well a line fits. You can assess a line with two informal checks on its gaps.
- Size: Are the gaps small compared with the spread of the data?
- Pattern: Are points above and below the line mixed all along it? Or do they sit on one side in some places and on the other side elsewhere?
For the free throws, Line A's gaps are only , or . That is small next to the spread of free throws from to . The signs of the gaps mix with no pattern, so Line A fits well.
Points on both sides of a line are a helpful sign. But the counts on each side do not need to match, and balance alone proves nothing. Line B has points below it and above, yet it fits poorly.
Key concept
A line of best fit is an approximate model
When the points of a scatter plot follow a roughly straight path, a straight line can model how the two quantities change together. Choose and judge a line by how close all the points stay to it, using their vertical gaps. Do not judge it by how many points it passes through. A good fit has gaps that are small and mixed above and below. If the points bend away from the line, a straight line is a poor model. The line's equation is exact, but its fit is approximate. Points on both sides are a helpful sign, not a rule that the counts must be equal. A good fit shows that the quantities go together, not that one causes the other.
Now look at a different data set. Here and are plain numbers with no units, and runs from to . The 8 points are , , , , , , and . Someone models these data with Line C, . In the figure below, the horizontal axis shows and the vertical axis shows .
Worked example
Assess a line on bending data
Assess how well Line C, , fits the 8 points of the second data set.
Each gap needs the line's value at the same . Find Line C's -value at each from to by substituting into . For example, at the value is .
Subtract each line value from the data value at the same to get the vertical gaps.
Check the size. Add the gap sizes, ignoring signs. The total is , and two points miss by . That is a big miss when the -values only run from to .
Check the pattern. The gaps are negative at and , positive from to , and negative again at and . So the points sit below the line at both ends and above it in the middle. Exactly points are above and below, so the balance looks fine, yet the points bend away from the line.
Compare the rises to see why. Line C changes by the same amount at every step: exactly each time grows by . The data rise by and then fall by , shrinking at every step. The free-throw rises jumped between and with no steady trend. Rises that shrink steadily trace a curve, and a straight line cannot bend to follow it.
Answer
Line C is a poor fit. Its misses reach , and the points fall below, then above, then below the line, so a straight line is not a good model for this data set.
Takeaway: When the points of a scatter plot follow a roughly straight path, a straight line can model how the two quantities change together. To choose among lines, pick the one all the points stay closest to, measured by vertical gaps. Do not pick the one that passes through the most points. To judge a fit, check the size and pattern of the gaps. Small, mixed gaps mean a good approximate fit, while points that bend away mean a straight line is a poor model. Even a good fit shows only that two quantities go together, not that one causes the other. Next, you will fit a line to a scatter plot yourself and write an equation for a line of best fit.