The least-squares line
◈ 5 cardsMinimise Σe²; the slope from SP_xy / SS_xx and the intercept from the means; three equivalent slope forms and the rounding trap.
The line that makes the errors smallest
Many lines pass near the eight points. The least-squares line is the one that minimises the sum of the squared vertical gaps
Vertical, because is the response being predicted; squared, so that positive and negative misses do not cancel and large misses are penalised. The minimising slope and intercept have closed forms:
where and — the two numerators you already built in L4.1 and L4.2. The intercept formula says the line always passes through the point of means .
Worked example — fitting Northfield's line
.
.
Three forms of the same slope
Because and , the slope can be written three ways, and the paper may hand you the inputs for any of them:
Check: ; . Same line.
The rounding trap
The third form is where marks go missing. Use (three decimals) and the slope comes out ; use and it is — off in the second decimal. The intercept then inherits the error multiplied by . Carry and the SDs to at least four decimals until the final line, or — better — take the slope from , where every input is an exact sum.
What the fit cannot tell you
Least squares always produces a line, for any cloud of points, however curved or however dominated by one point. That the arithmetic ran is not evidence that a line is the right description; the scatter plot and have to have earned it first.