Least-Squares Regression
A least-squares regression line is the single straight line that makes the total squared vertical distance from the data points as small as possible — the best linear summary of how one quantity moves with another.
Definition
When two quantitative variables show a roughly linear relationship, the least-squares regression line (LSRL) predicts a response y from an explanatory variable x. "Least squares" means the line is chosen to make the sum of the squared residuals as small as possible, where a residual is the vertical gap between an actual data point and the line's prediction.
The formula & procedure
The line is ŷ = a + b·x. Its slope is b = r · (s_y / s_x) and its intercept is a = ȳ − b·x̄, so the line always passes through the point (x̄, ȳ). Here r is the correlation and s_x, s_y are the standard deviations of x and y. A residual is (observed y − predicted ŷ). The coefficient of determination r² is the fraction of the variation in y that the linear relationship with x explains.
Worked example
A bakery tracks hours since a loaf left the oven (x) against a firmness score (y). Suppose x̄ = 4 hours, ȳ = 6 points, s_x = 2 hours, s_y = 1.5 points, and r = 0.8. The slope is b = 0.8·(1.5/2) = 0.6 points per hour, and the intercept is a = 6 − 0.6·4 = 3.6, giving ŷ = 3.6 + 0.6x. A 5-hour-old loaf is predicted at 3.6 + 0.6·5 = 6.6 points; if it actually scored 6.2, the residual is 6.2 − 6.6 = −0.4, so the model over-predicted. With r = 0.8, r² = 0.64, so about 64% of the variation in firmness is explained by time out of the oven.
The classic mistake
Extrapolating — using the line far outside the range of x you actually observed (predicting firmness at 40 hours). Two more: reading a residual's sign backward (residual = actual − predicted, so a negative residual means the line predicted too high), and treating a strong r² as proof that x causes y. A tight fit never establishes causation on its own.
See how you’d score on this.
Reading about it is one thing — a short, free diagnostic shows you exactly where least-squares regression sits in your AP Statistics score, and what to fix first.
Start a free diagnostic