Statistics
Least Squares
The best-fit line is the one that minimises the total squared error. Here each error is drawn as a literal square, so the line is quite literally the one that shrinks the total area the most.
Fit—
Sum of squares—
R²—
Points0
Drag any point to move it. Click empty space to add a point. The orange line is the least-squares fit; the shaded squares are the residuals, squared.
What to observe
- The fit line is exactly the one that makes the total area of the shaded squares as small as possible. Drag a point and watch the squares fight back.
- Drag one point far off the trend. Because errors are squared, that single outlier drags the whole line toward it: least squares is not robust.
- The line always pivots through the mean point (x̄, ȳ). Add points symmetrically and the slope changes while that balance point stays put.
Shortcuts: space run/pause · s step · r reset · f fullscreen