TwiddleLab / Math / Functions You Can See
Fitting a Line to Data
What you will learn
- A model is a simple rule that describes messy data, like a line through a cloud.
- A residual is a miss: the real value minus the line's prediction.
- The best-fit line is the one with the smallest total miss. One bad point can drag it far.
How the lesson goes
10 students: daily practice and typing speed. Can one line describe them?
Draw your best line through the cloud. Press and drag.
Now tune your line. Every miss shows as a stick.
Drag the two handles. Get the average miss down to the green mark: 2.5 words a minute or less.
Tap every student your line over-guesses.
Over-guessing means the line says more than the student really types: the point sits under the line.
Three words for fitting.
A model is a simple rule that stands for messy data. This line is a model of typing speed.
A residual is one miss: the real value minus the line's prediction. Each stick is a residual.
The best-fit line has the smallest total miss. Here: about 1.5 more words a minute for each minute of practice.
A typo sneaks into the data. The line jumps.
The machine fits a line to every point, typos too. Find the bad point and tap it to remove it.
Game: beat the machine.
A new cloud each round. You get 10 seconds to place your line, then the machine draws its best one. Get within 10%.
How could a computer find the best line by itself?
Run both strategies for 20 moves. Then tap the one that ended with the smaller miss.
Mia practices 16 minutes a day and types 6 words a minute faster than your line predicts.
Drag Mia's point to where she really is.
Speed round: does a line fit?
Three clouds, 10 seconds each. Fling each one left if one straight line fits it, right if not.
Previous lesson: Stretch, Flip, Shift · Next lesson: Zoom In: Slope of a Curve · Part of the course: Functions You Can See
Lessons are interactive and need JavaScript. Turn it on to play them.