Mistake Master
Student view — seeing the site as a student does
Mistake Master · AP Statistics · Unit 5 · Step-Through Animation

Least-Squares Regression

The Line That Loses Least, and the Number Everyone Misreads

You'll learnwhat the least-squares criterion actually minimizes — squared, vertical, minimized, three words each hiding a standard wrong answer — how the slope comes from r and the two standard deviations, why the line always passes through the point of averages, what r-squared counts and what it does not, and how one high-leverage point can reverse a slope.

Eight students report their weekly study hours and their exam scores, and of all the lines that could be drawn through that cloud, least squares picks exactly one: score = 58.5 + 3.5 · hours. The rule it uses is more specific than it sounds — it makes the sum of the squared vertical misses as small as possible — and this page runs 5,751 rival lines to show that none of them beats 25.0. Then the number everyone misreads: r-squared = 0.954 says the linear model with study hours accounts for 95.4 percent of the variability in scores. Read as "95.4 percent of the points are on the line" it predicts 7.6 of the 8 points, and the actual count is 1. Twelve short steps; press Next for each one.

12 STEPS · 6 QUICK CHECKS · THE CRITERION · THE FORMULAS · R-SQUARED · INFLUENCE · v2

No rival line beats 25.0; r² counts variability, and 1 of 8 points is on the line
Before you start
What you're looking at
Eight students' weekly study hours and exam scores, and the one line least squares picks out of every line that could be drawn.
The question
What does that line make small — and what does the 0.954 attached to it actually count?
Step 1 / 12

Read all 12 steps as text
Step 1

Which line goes through this cloud?

Eight students reported a study week and sat the same exam, and the cloud they make climbs — but infinitely many straight lines could be drawn through it, and only one of them is the regression line.

Step 2

Every line leaves some misses

Draw a line and every student is a little off it, straight up or straight down — that vertical gap is the residual, and one student happens to land on the line exactly.

Step 3

Square each miss and add the areas

Each miss grows into a square whose side is the miss itself, so the criterion is a total area — and squaring is why a miss of 3 costs 9 while two misses of 1.5 cost 4.5 between them.

Step 4

Three lines, three totals

A flat line at the mean score predicts the same thing for everyone; a ruler laid through the first and last students is perfectly plausible; and the least-squares line beats them both on the one thing being counted.

Step 5

No line beats 25.0

"Least" is a claim about every other line there is, so this page checks it: on every load it tries 5,751 candidate lines — every slope from 0 to 7 in steps of 0.1 and every intercept from 40 to 80 in steps of 0.5 — and reports what it found.

Step 6

The line must pass through the mean point

Watch the candidates swing: whatever the slope, each one is pinned at the point of averages, because \(b_0 = \bar{y} - b_1\bar{x}\) is exactly the statement that the line returns the mean of \(y\) at the mean of \(x\).

Step 7

The slope is r stretched by the spreads

The criterion picks the angle, and the formula names it: \(b_1 = r\,s_y/s_x\), the correlation rescaled by the two spreads, which is what turns a unitless number into points per hour. The page computes it that way and directly, and checks the two agree.

Step 8

Where the variability goes

The scores vary by a total of 539.5, and that total is exactly what a flat line at the mean would leave behind; the fitted line takes almost all of it and hands back only what it could not explain.

Step 9

It counts variability, not points

Read as a share of the points, 0.954 would put 7.6 of the eight students on the line; the dashed outline is that claim and the filled cells are the truth, which is one.

Step 10

Four sentences that go wrong

Each of these arrives constantly and each fails for its own reason: it is not a count of points, not a success rate, not an accuracy, and above all not a cause.

Step 11

Fit is not cause, at any r-squared

These students chose their own hours, so whatever travels with that choice — preparation, motivation — travels with the association; the sentence that survives claims fit, and fit is what was measured.

Step 12

One student can reverse the slope

Add one student at twenty hours who scored forty and refit with the same criterion: the squares punish distance, and a point far out in \(x\) has leverage, so the line swings until its slope changes sign. Both fits get reported, and the point gets named and investigated rather than quietly dropped.