Unit 5 · Topic 5.5 · about 25 minutes
Least-Squares Regression
Get the least-squares regression line from technology and interpret its slope, y-intercept and coefficient of determination in context.
Predict first
Three students each draw a line through the same scatterplot, and each claims to have the best one. Which rule do statisticians use to settle the argument?
What least squares means
Every line drawn through a scatterplot leaves residuals. Squaring them does two jobs. Every miss counts as positive, so misses above the line cannot cancel misses below it. And a big miss counts far more than a small one. Out of all possible lines, exactly one makes the sum of the squared residuals as small as it can be. That line is the least-squares regression line, often shortened to LSRL.
Jordan recorded the most pull-ups he could do in each of his first five weeks of training: 2, 5, 4, 7 and 9. Line A connects his first week to his fifth. Line B is the least-squares line.
| Week, | Pull-ups, | Line A residual | Line A squared | Line B residual | Line B squared |
|---|---|---|---|---|---|
| 1 | 2 | ||||
| 2 | 5 | ||||
| 3 | 4 | ||||
| 4 | 7 | ||||
| 5 | 9 | ||||
| Sum of squares |
Line A hits two of the points exactly and still loses, 3.875 to 3.60. No line through these five points does better than 3.60. That is what the least-squares line guarantees.
You will not find the least-squares line by trying lines one at a time, or by hand at all. A calculator or software computes the slope , the y-intercept and the correlation from the data.
One fact about the line is worth knowing without technology: it always passes through the point . Jordan's averages are weeks and pull-ups, and Line B gives exactly.
Jordan's five weeks with the least-squares line
The line passes through , the point of averages, even though no week landed there.
Reading regression output
Software prints the least-squares line as a small table. This output comes from 15 apartments in one city, with floor area in square feet used to predict monthly rent in dollars.
| Predictor | Coef |
|---|---|
| Constant | 462.14 |
| Size | 1.2148 |
Under the table, the output adds S = 174.61 and R-Sq = 80.8%.
- The Constant row holds the y-intercept, .
- The row named for the explanatory variable holds the slope, .
- R-Sq is , the coefficient of determination, written as a percent. It is the proportion of the variation in the response variable that is explained by the linear relationship with the explanatory variable.
So the model is . Output usually prints more than you need. S is not part of this course, so find the two coefficients and R-Sq and leave the rest.
Rent and size for 15 apartments, with the least-squares line
Sizes run from 450 to 1,400 square feet. A size of 0 is far off the left edge of the data.
Worked exampleInterpreting the rent model
Use the output above. Interpret the slope, the y-intercept and in context, and find the correlation .
Slope. For each additional square foot of floor area, the predicted monthly rent increases by about 1.21 dollars. A square foot is small, so scaling up can help: 100 more square feet goes with about 121 dollars more in predicted rent.
Y-intercept. An apartment with 0 square feet has a predicted rent of 462.14 dollars. That has no reasonable meaning here. The apartments ranged from 450 to 1,400 square feet, so a size of 0 is far outside the data, and an apartment with no floor area does not exist.
. About 80.8% of the variation in monthly rent is explained by the linear relationship with floor area. The other 19.2% is variation the line does not account for, from things like location and the age of the building.
Correlation. . It is positive because the slope is positive; both describe the same upward direction.
Slope: about 1.21 dollars more in predicted rent for each additional square foot. Intercept: no sensible meaning, since 0 square feet is far outside the data. : about 80.8% of the variation in rent is explained by the linear relationship with size. .
Check your understanding
A model predicts a car's highway gas mileage (miles per gallon) from its weight (thousands of pounds). For this model, . Which is the correct interpretation?
The least-squares line for predicting how many minutes a phone's battery lasts from its screen brightness setting (percent) is . Which is the correct interpretation of the slope?
For 40 students, the mean number of hours spent studying for a test is 6.2 and the mean test score is 81.5. The least-squares line for predicting score from hours studied has slope 2.4. What score does the line predict for a student who studied 6.2 hours?
A teacher used data from 35 students to predict the final course grade (percent) from the number of absences. Computer output for the least-squares regression is shown.
What final grade does the model predict for a student with 6 absences?
Each model below was fit to the data described. For which model does the y-intercept have a reasonable interpretation in context?
Course alignment, for teachers
AP Statistics topic 5.5, Unit 5: Regression Analysis.
- Skill 3.B: Calculate summary statistics, relative positions of points within a distribution, and predicted responses.
- Skill 4.D: Interpret statistical calculations and results to assess meaning or a claim.