5.5 - Least-Squares Regression
Overview
Many lines could be drawn through a scatterplot. The one AP Statistics uses is the least-squares regression line (LSRL), the line that makes the squared prediction errors as small as possible. This topic covers what "least squares" means, how to get the line, , and from technology or computer output, and how to interpret the slope, the -intercept, and in context. Those interpretations show up on almost every AP exam.
The least-squares idea
The simple linear regression model is fit to the data by minimizing the sum of the squares of the residuals. That's why the result is called the least-squares regression line (LSRL), or the line of best fit.
Why squares? Residuals are positive and negative, so plain residuals would cancel out. (For the LSRL they add to exactly 0.) Squaring makes every miss count as a positive amount, and it makes big misses count much more than small ones.

In the figure, each red square has a side as long as one residual, so its area is that residual squared. For the least-squares line on the left, the residuals are , , , , and :
The line on the right looks just as reasonable by eye, but its residuals (, , , , ) give a total of 4.0. No line through these five points gets the total below 3.6, and that's exactly what makes the left line the least-squares line.
The LSRL passes through the point of means
The least-squares line always passes through the point . Plug in , and the model predicts .

For the used cars from Topic 5.1, years and thousand dollars, and . This fact is handy when a problem gives you the means and the slope but not the intercept.
Example 1: Finding the intercept from the means
The 10 used cars have mean age 5.0 years and mean price 20.0 thousand dollars, and the slope of the LSRL is . Find the -intercept.
Since is on the line, substitute it into :
Answer: , so the LSRL is .
Getting , , , and from technology
In this course, the slope , the -intercept , and the correlation are all calculated with technology. The formula sheet only gives . The slope and always have the same sign.
On the TI-84:
- Enter the -values in L1 and the -values in L2 (STAT > 1:Edit).
- Turn on diagnostics once so and show up: MODE, set STAT DIAGNOSTICS to ON (on older models: 2nd > 0 for CATALOG, choose DiagnosticOn, press ENTER twice).
- Press STAT > CALC > 8:LinReg(a+bx). Set Xlist to L1 and Ylist to L2. To graph the line too, set Store RegEQ to Y1 (VARS > Y-VARS > 1:Function > Y1). Choose Calculate.
For the cars, the calculator shows:
TI-84 shows | What it is | Used cars |
a | -intercept | 29.0 |
b | slope | |
r² | coefficient of determination | 0.928 |
r | correlation coefficient |
Reading computer output
AP questions often give computer regression output instead of a calculator screen. Here is the output for the 20 wolves from Topic 5.4 (lengths from 142 to 188 cm):

- The Coef in the Constant row is the -intercept: .
- The Coef in the row named for the explanatory variable (here, Length) is the slope: .
- R-Sq is : here 75.9%, or 0.759.
So the LSRL is , or predicted weight = (length). The other entries (SE Coef, T, P, and R-Sq(adj)) are for inference and model comparisons beyond this course, so you can skip them. S is the typical size of a residual, about 3.06 kg here. The most common slip is reading the slope from the Constant row: the slope is always in the row with the variable's name.
The output doesn't show , but you can get it from : take the square root and give it the same sign as the slope. Here, , positive because the slope is positive.
Interpreting the slope
The slope is the predicted increase or decrease in the response variable for a one-unit increase in the explanatory variable. Always interpret it in context.
Template: "For each additional [1 unit of ], the predicted [response] increases (or decreases) by [ and units]."
Cars (): For each additional year of age, the predicted price of the car decreases by 1.80 thousand dollars ($1,800).
Two words do a lot of work here. "Predicted" (or "on average") shows that the slope describes the model's trend, not a guarantee for every individual. "For each additional" shows it's a rate: change per one unit of , not just "a change." Leaving either one out costs credit.
Interpreting the -intercept
The -intercept is the predicted value of the response variable when the explanatory variable is 0, interpreted in context.
Template: "When [ in context] is 0, the predicted [response] is [ and units]."
Sometimes the intercept has no reasonable meaning, for two reasons:
- is outside the interval of -values used to find the line, so interpreting is an extrapolation.
- The predicted value is impossible, like a negative weight or height.
Cars (): A car that is 0 years old (new) has a predicted price of 29.0 thousand dollars ($29,000). Age 0 is just below the data's range (1 to 10 years), so this is a small extrapolation: reasonable, but treat it with some caution.
For the wolves, the intercept is a predicted weight of kg, which has no meaning (Example 2 explains why). AP questions often say "interpret the intercept, or explain why it isn't meaningful." Either way, you need context.
The coefficient of determination,
In simple linear regression, the square of the correlation coefficient, , is called the coefficient of determination. It's the proportion of the variation in the response variable that is explained by the linear relationship with the explanatory variable.
Template: "About [ as a percent] of the variation in [response] is explained by the linear relationship with [explanatory variable]."
Cars (): About 92.8% of the variation in the listed prices of these cars is explained by the linear relationship with age. The other 7.2% comes from things the model leaves out, like mileage and condition.
Where comes from
Without the model, your best guess for every car's price is , and the squared distances from add up to 279.24 (the total variation in price). Using age, the squared residuals add up to only 20.04, so the line accounts for
Some things to remember about :
- . It's never negative, so it can't show direction. Get the direction from the sign of the slope.
- It's about variation in the response (), not in . Multiple-choice questions love to swap the two.
- A high doesn't prove a linear model is appropriate. That's the residual plot's job (Topic 5.4).
The coefficients are statistics
The slope and the -intercept of the least-squares line are statistics, because they're calculated from a sample of data, not from the whole population. A different sample gives a different line: another 10 used cars of the same model would give a slightly different slope and intercept. The LSRL from a sample estimates the true relationship in the population, the same way estimates .
Putting it together
Example 2: Wolves (AP-style)
Use the computer output for the 20 wolves above (body lengths from 142 to 188 cm).
(a) Write the equation of the least-squares regression line. Define any variables you use.
, where is body length in centimeters and is predicted weight in kilograms.
(b) Interpret the slope in context.
For each additional centimeter of body length, the predicted weight of a wolf increases by about 0.508 kg.
(c) Interpret the -intercept, or explain why it isn't meaningful.
It would be the predicted weight of a wolf with a body length of 0 cm, kg. That isn't meaningful. No wolf has length 0, a length of 0 is far outside the data (142 to 188 cm), so it's an extrapolation, and a weight can't be negative. Here the intercept only places the line.
(d) Interpret , and find the correlation.
About 75.9% of the variation in wolf weight is explained by the linear relationship with body length. Since the slope is positive, : a strong, positive linear association between body length and weight.
(e) Predict the weight of a wolf that is 175 cm long.
The model predicts about 46.0 kg. Since 175 cm is inside the range of lengths in the data (142 to 188 cm), this is an interpolation.
Example 3: Finding from and the slope
A least-squares line has slope and . What is ?
Answer: , and has the same sign as the slope, which is negative. So , a moderate negative linear association.
Common mistakes
- Interpreting the slope without "predicted" (or "on average"), or without "for each additional unit."
- Reading the slope from the Constant row. The slope is in the row named for the explanatory variable.
- Taking the positive square root of when the slope is negative. always has the slope's sign.
- Calling the variation in , or "the percent of points on the line." It's the proportion of variation in explained by the linear relationship with .
- Interpreting an intercept that's impossible or an extrapolation without saying so.
- Forgetting that the LSRL passes through , which can give you a missing intercept.
BackNext