Lesson 2.4 · Exploring Two-Variable Data
Least-squares regression
Correlation tells you how strong a linear relationship is. A regression line goes further: it gives you an equation you can use to predict the response from the explanatory variable. Of all the lines you could draw through a scatterplot, statistics picks one specific line, the least-squares regression line, and this lesson explains how it is chosen, how to find it, and how to interpret it.
Regression lines and predicted values
A regression line summarizes a linear relationship with an equation of the form
where ("y-hat") is the predicted value of the response for a given , is the slope, and is the y-intercept. AP Statistics writes the intercept first, and always uses rather than , because the line gives predictions, not actual data values.
A student tracked the hours she studied for six quizzes and her scores.
| Hours studied, | ||||||
|---|---|---|---|---|---|---|
| Quiz score, |
Technology gives the regression line .
For hours the line predicts points. Her actual score was , so the prediction was off by points. That difference, actual minus predicted, is called a residual. You'll study residuals in detail in the next lesson; for now, a residual is the vertical distance from a point to the line.
The least-squares criterion
Every line through the data leaves some residuals. Some are positive (points above the line) and some are negative (points below). To choose the "best" line, we square each residual, which makes them all positive and penalizes big misses heavily, and add them up.
Definition
Least-squares regression line
The least-squares regression line (LSRL) is the line that makes the sum of the squared residuals as small as possible. Its slope and intercept are
Two consequences are worth remembering:
- Since , rearranging gives . The LSRL always passes through the point .
- The slope and always have the same sign, because and are positive.
Worked example: The LSRL from summary statistics
For a class of students, the number of minutes spent reviewing notes before a quiz has mean and standard deviation . Quiz scores have mean and standard deviation . The correlation is . Find the equation of the LSRL.
The LSRL is . Check: at the line gives , as it must.
Interpreting slope and intercept
Interpretations must use context and must describe predicted values.
AP-style interpretations
- Slope: "For each additional 1 [unit of ], the predicted [] increases (or decreases) by [units of ]."
- y-intercept: "When [] is , the predicted [] is [units]." Only interpret it if makes sense and is near the data.
For the review-minutes model: for each additional minute of reviewing notes, the predicted quiz score increases by points. The intercept says a student who reviews for minutes has a predicted score of . Is that trustworthy? Minutes had a mean of and a standard deviation of , so minutes is standard deviations below the mean, far outside the data. Using the line there is extrapolation.
Common mistake
Extrapolation means using a regression line to predict for -values outside the range of the data. The linear pattern may not continue, so extrapolated predictions are often badly wrong. The study-hours line predicts that hours of studying gives a score of , which is impossible on a -point quiz.
The coefficient of determination
How good is the line at predicting? The coefficient of determination answers this.
Definition
Coefficient of determination
is the proportion (or percent) of the variation in the response variable that is accounted for by the least-squares regression line with the explanatory variable. It is literally the square of the correlation.
For the study-hours data, , so . Interpretation: about of the variation in quiz scores is accounted for by the least-squares regression line with hours studied. The remaining is due to other factors.
If you know and want , take the square root and give it the sign of the slope. An of with a negative slope means .
Reading computer output
AP questions often give regression output instead of an equation. An engineer regressed the highway fuel efficiency (miles per gallon) of cars on their weight (thousands of pounds):
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Weight |
The Coef column holds the intercept (next to "Constant") and the slope (next to the explanatory variable's name). The other columns are for inference, which comes much later in the course.
Worked example: Using regression output
Use the output above. (a) Write the LSRL. (b) Interpret the slope. (c) Predict the fuel efficiency of a car weighing pounds. (d) Find .
(a) , with weight in thousands of pounds.
(b) For each additional pounds of weight, the predicted fuel efficiency decreases by about miles per gallon.
(c) Weight is in thousands, so use : mpg.
(d) and the slope is negative, so .
Regression toward the mean
The formula says something surprising. If is one standard deviation above , the predicted is only standard deviations above . Since , predictions are always closer to the mean (in standard units) than the -values they come from. Tall parents tend to have tall children, but on average not quite as tall. This is regression toward the mean, and it is where the word "regression" comes from.
Tip
The LSRL of on is not the same as the LSRL of on . The first minimizes vertical distances; the second would minimize horizontal ones. Always regress the response on the explanatory variable, and don't solve the equation backward to predict from .
Practice
Using the study-hours model , predict the quiz score for a student who studies hours.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
For a group of adult men, heights have inches and inches, weights have pounds and pounds, and . What is the slope of the least-squares regression line for predicting weight from height?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Using the same summary statistics (, , slope ), find the -intercept of the least-squares regression line.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
For the car output in the lesson, which is the correct interpretation of the slope?
A regression of the number of ice cream cones sold () on the daily high temperature in °F () produces this output. Which is the equation of the least-squares regression line?
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Temperature |
A least-squares regression of a car's resale value on its age has a negative slope and . What is the correlation ?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
For the study-hours data, . Which is the correct interpretation?
In the review-minutes example, . A student reviewed for a number of minutes that is standard deviations above the mean. Her predicted quiz score is how many standard deviations above the mean score?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.