Line of Best Fit
You'll collect 30 pairs of measurements, plot them on graph paper, and fit a line through them by hand with least squares.
About
Every trend line you've seen on a chart came from this calculation. Doing it once with a pencil tells you what the line is saying, and what it isn't. You need two things that might be related, like height and shoe size, outdoor temperature and the gas bill, or pages in a book and its weight. You'll collect thirty pairs, draw one plot, work through one formula, and write one honest sentence about causation. One typo in the x squared column throws the slope off by half, so add every column twice.
At a glance
- Per requirement
- 25 XP
- Completion bonus
- 150 XP
- Requirements
- 6
- Takes
- Three weeks
- Skill level
- Beginner (done it a few times)
- Cost
- Cheap (under $10)
- Supplies
- You need some
- Where
- At home
- Other people
- On your own
Requirements
-
1
Pick two measurable things and collect 30 pairs. Measure them yourself. Try the temperature at noon and how many people were at the park, or the height and arm span of 30 friends, or the age and price of 30 used cars from one listing site. Take a photo of the raw table. Photo
-
2
Draw a scatter plot by hand on graph paper. Label both axes with units, and choose scales so the points fill the page. Look at it before doing any math and write one sentence about what you see. Take a photo of the plot. Photo
-
3
Work out the slope and intercept with the least squares formulas. You'll need the sum of x, the sum of y, the sum of xy and the sum of x squared, so lay them out in four columns. The slope is n times the sum of xy minus the sum of x times the sum of y, over n times the sum of x squared minus the square of the sum of x. Use a calculator for the sums, but write out every column. This takes about an hour. Take a photo of the columns and the result. Photo
-
4
Draw the line on your plot and work out the correlation coefficient. Plot two points from your equation and rule the line through them. Then find r: it's the slope's numerator over the square root of the slope's denominator times the same thing for y, so add a y squared column. It lands between minus 1 and 1. Say what it means in plain words, like 'taller people have slightly longer arm spans, and the fit is tight.' Take a photo of the line and the r calculation. Photo
-
5
Find the point with the biggest residual and go and look at it. That's the point furthest from the line. It's a measurement error, a typo or a real outlier, so find out which one and say so. Take a photo of the point circled with a line about what you found. Photo
-
6
Name a third variable that could drive both, and say how you'd test for it. The plot can't tell you that x causes y. Write one paragraph under the plot naming one thing that could move both x and y, and the measurement that would separate them. Take a photo of the paragraph. Photo