Pl. III
Explorable
Pl. III · Explorable · Statistics, seen 3/3
Statistics, seen · 3 of 3
Least squares, by hand
The best-fit line is the one that makes the squared vertical misses as small as possible. Push the points around and you can feel which ones it listens to.
§1 · Try it
Try it
The vermilion line is the least-squares fit. The dashed teal lines are the residuals: how far each point sits above or below the line. Turn on the squared residuals to see what the fit minimises, which is the total area of those squares.
- Line
- ŷ = 1.13 + 0.85·x
- Correlation r
- 0.72
- R²
- 0.52
- Sum of squared residuals
- 26.6
- Points
- 12
§2 · Notice
Three things to notice
- The line always passes through the middle of the data, the point (x̄, ȳ). Drag any point and the line pivots, but it never leaves that centre.
- Points far to the left or right pull hardest. Press Add a far-out point and the whole line swings towards it. Such points have high leverage: they sit far from x̄, so the line can't avoid them. Points near the middle can move a lot and change little.
- r measures how tightly the points hug a line, not how steep it is. A shallow line through a tight cloud has a high r. A steep line through a loose cloud has a low one. R², the square of r, is the share of the variation in y that the line accounts for.
§3 · Play
Guess the correlation
Each cloud has 40 points and an exact, hidden correlation between −1 and +1. Slide to your guess and check it. It is harder than it looks.
−1 · falls0 · no pattern+1 · rises
No guesses yet · rounds never run out