Least-squares regression line
Predict a response using the line minimizing squared residuals.
Least-squares regression line is one of 3 regression formulas in the statistics section of this library, and it is used at ap · university level.
Why least-squares regression line works
The line is chosen to make the total of the squared vertical misses as small as possible. That single requirement pins down both numbers: it forces the line through the point of averages, and it makes the slope equal the correlation rescaled from the spread of x into the spread of y.
What each symbol means
$b_1$ is slope, $b_0$ intercept, and $\hat y$ predicted response.
Least-squares regression line: when it holds
$s_x>0$; interpret within the data range unless extrapolation is justified.
When it stops applying
The fitted relationship is only supported over the range of x actually observed. A line built from children aged 2 to 10 will happily predict a height for a 40-year-old, and the prediction will be absurd. Nothing in the arithmetic warns you that you have left the data behind.
Least-squares regression line: a worked example
If $r=.8,s_y=10,s_x=4$, then $b_1=2$.
The mistake to avoid
What people do: Flipping the two spreads in the slope, using s of x over s of y.
Why it goes wrong: With a correlation of 0.8, a y spread of 10 and an x spread of 4, the slope is 2. The flipped version gives 0.32, a line that is far too flat and predicts badly at every x.
Do this instead: Remember the slope carries the units of y per unit of x, so the y spread has to sit on top for the units to come out right.
Least-squares regression line: step by step
- Name the unknown, and the unit the answer has to come out in.
- Match the symbols to your values. $b_1$ is slope, $b_0$ intercept, and $\hat y$ predicted response.
- Check the conditions before substituting. $s_x>0$; interpret within the data range unless extrapolation is justified.
- Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most statistics slips.
Where this formula fits
- Subject
- Statistics formulas — 21 entries in this library
- Topic
- Regression
- Level
- AP · University
Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where least-squares regression line comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.
- Linear Regression — the lesson behind this formula: fit and interpret a linear relationship honestly.
- Statistics Calculator — check your substitution and the value it produces.
- Study statistics — the subject guide that explains the ideas these formulas compress.
- Statistics Practice — questions that make you retrieve the formula instead of recognising it.
- All 21 statistics formulas — the full grouped reference, or the complete formula library.
Questions about least-squares regression line
Does the line pass through any of the actual data points?
Not necessarily, and often through none of them. It always passes through the point made by the two means, which is a useful check when you plot your fitted line by hand.
Is the line for predicting y from x the same as the one for predicting x from y?
No, they are two different lines unless the correlation is exactly 1 or -1. Each one minimises misses in its own direction, so swapping the roles changes the answer.
How do I know a straight line was the right choice?
Plot the residuals against x. A shapeless band supports the line, while a clear curve or a fanning pattern says the model is missing something the data are trying to tell you.
What does the intercept mean in a real problem?
It is the predicted response when x is zero, which is only meaningful if zero is a sensible and observed value of x. Otherwise treat it as a number that positions the line, not as a finding.