Fit the Line

How to play Fit the Line

Fit the Line is a free game that trains your eye for the line of best fit. You place a trendline over a scatter plot, then the game shows the true least-squares regression line and scores how close you were.

What is a line of best fit?

A scatter plot shows pairs of numbers as dots. When the dots rise or fall in a rough pattern, a straight line can describe the trend. The least-squares regression line is the line that makes the total of the squared vertical distances from the dots to the line as small as possible. Those distances are called residuals.

In Fit the Line you try to draw that line by eye. The closer you get, the higher your score.

Playing solo

  1. Look at the dots. The line should run through the middle of the cloud, with about as many dots above it as below it.
  2. Drag the two handles to move your line. With a keyboard, focus a handle and use the arrow keys (hold Shift for bigger steps).
  3. Press Check line. The pink line is the true least-squares line, and the shaded area is the gap between it and yours.
  4. Your score for the round is 0 to 100. Play 10 rounds for a total out of 1000. Your best average for each difficulty is saved on your device.

Difficulty

  • Easy has tightly grouped dots.
  • Medium is more spread out.
  • Hard is the loosest and adds two stray points that pull the true line toward them.

After you check

You see both equations, the sum of squared residuals (SSE) for each line, and the correlation coefficient r. A menu under the plot can draw the residuals for your line or for the best-fit line.

Tips for a better line

  • The least-squares line always passes through the middle point of the data, the point made from the average x and the average y. Aim your line through the center of the cloud first, then tilt it.
  • Check the direction first. If the dots rise from left to right, the slope is positive. If they fall, it is negative.
  • On Hard, watch the stray points. A point far from the others can pull the true line toward it more than a point near the middle.
  • Use the residuals menu after each round to see which dots made your line miss.

How scoring works

The game measures the average vertical gap between your line and the least-squares line across the whole graph.

score = 100 x (1 - gap / 2), never below 0

A perfect match scores 100. An average gap of 2 units or more scores 0.

Playing in a class

  1. Your teacher launches a class game and puts a 4-letter code on the board.
  2. On the Fit the Line home page, press Join a class, type the code and your first name or a nickname, and press Join.
  3. Wait for the teacher to start. Everyone plays the same dots in each round.
  4. Drag your line, then press Lock in. You cannot change it after that.
  5. When the teacher reveals the answer, you see your score and the class scoreboard. If you close the page by accident, use Rejoin on the home page.

Teachers: see the guide for teachers for how to run a class game.