The least-squares regression line is the straight line that best predicts a response from an explanatory variable , and you can find it from data or from five summary statistics. Its slope is , and it always passes through . You interpret the slope and intercept in context, predict only within the range of the data, and read and straight off computer output.
Quick check
A line is . What is when ?Show answerHide answer
.
Two variables have a strong positive correlation. Will the slope of the regression line be positive or negative?Show answerHide answer
Positive: the slope always has the same sign as , because and standard deviations are positive.
Know these already? Jump to the practice questions
What you'll be able to do
- Calculate the least-squares regression line from summary statistics or from data.
- Interpret the slope and the y-intercept in context.
- Use the line to predict, and explain why extrapolation is risky.
- Identify the equation of the line from computer regression output.
Key terms
Least-squares regression line
The line that makes the sum of the squared vertical distances from the points to the line as small as possible.
- In plain English
- The line that fits the points best, judged by how far the actual -values are from the predicted ones.
- Don't write
- ; the hat shows that is a predicted value.
Slope
The predicted change in for each increase of 1 unit in .
- In plain English
- How much the prediction moves when goes up by one.
- Don't write
- " increases by "; it is the predicted (average) that changes.
Extrapolation
Using the line to predict for an -value outside the range of the data used to fit it.
- In plain English
- Predicting where you have no data.
- Don't write
- "the prediction is reliable because the line fits well"; a good fit inside the data says nothing outside it.
What makes the line "least squares"?
For each point, the vertical distance from the point to the line is , the actual value minus the predicted value. These are called residuals and have their own note (Residuals, Residual Plots and r²). The least-squares line is the one line that makes the sum of the squared residuals, , as small as possible.
The notation matters. ("y-hat") is a predicted value, and is the y-intercept: the predicted when .
Two facts follow from the least-squares criterion. The line always passes through the point of means , and its slope has the same sign as the correlation.
Check yourself
Show answerHide answer
, because the line always passes through .
How do you find the line from summary statistics?
On the formula sheet:
Find the slope first, then rearrange the second formula for .
Suppose, for 30 hypothetical students, hours studied has mean 4.5 and standard deviation 1.8, exam score has mean 76 and standard deviation 9, and . Then and , so .
The slope formula says the line rises standard deviations in for every standard deviation in . So a weaker correlation gives a flatter line, even with the same spreads.
With raw data, a graphing calculator's linear regression gives and directly; state the equation with the variables named.
Key idea
Slope first, , then .
Check yourself
Show answerHide answer
.
How do you interpret the slope and the intercept?
Use a sentence template, and always name the variables and units.
- Slope: "For each additional 1 [unit of ], the predicted [] increases (or decreases) by [units of ]." For the study line: for each additional hour studied, the predicted exam score increases by 3.6 points.
- Intercept: "When [] is 0, the predicted [] is ." For the study line: a student who studies 0 hours has a predicted score of 59.8 points.
The intercept only has a sensible meaning if is a reasonable value inside or near the data. A car that weighs 0 pounds does not exist, so in that context you say the intercept has no practical meaning.
Examiner's eye
Credit is lost when the slope is stated as a certain change. Say "predicted" or "on average", and name both variables with units.
Check yourself
Show answerHide answer
For each additional hour of homework, the predicted free time decreases by 0.8 hours.
How do you predict, and when is it risky?
To predict, substitute the -value into the line. For 6 hours of study, points.
A prediction is only trustworthy within the range of -values used to fit the line. Outside that range is extrapolation: the pattern may bend, level off or stop, so the prediction can be badly wrong, even impossible.
Check yourself
Show answerHide answer
No. 4.0 is inside the range of the data, so the prediction is reasonable.
How do you read computer regression output?
Software prints a table. The row labeled "Constant" (or "Intercept") gives in the "Coef" (coefficient) column; the row named for the explanatory variable gives . Other columns, such as "SE Coef", belong to inference for slope, a later topic.
| Predictor | Coef | SE Coef |
|---|---|---|
| Constant | 47.93 | 0.93 |
| Weight | −6.67 | 0.28 |
This hypothetical output, for car weight (thousands of pounds) and fuel efficiency (miles per gallon), gives .
Check yourself
Show answerHide answer
: heavier cars have lower predicted fuel efficiency.
Worked example 1: From summary statistics to a prediction
Question: For 25 hypothetical trees, trunk diameter has mean 12 inches and standard deviation 4 inches, height has mean 60 feet and standard deviation 10 feet, and . (a) Find the least-squares regression line for predicting height from diameter. (b) Interpret the slope. (c) Predict the height of a tree with diameter 15 inches.
What tells you the method
Summary statistics and "least-squares regression line" mean , then .
Step 1: Slope.
.
Whyis height, so goes on top.
Step 2: Intercept.
, so .
WhyThe line passes through .
Step 3: Interpret and predict.
For each additional inch of diameter, the predicted height increases by 2 feet. At 15 inches, feet.
WhyThe slope sentence names both variables and units, and 15 inches is close to the mean diameter, so it is not extrapolation.
Check it
15 is 0.75 standard deviations above the mean diameter, and is standard deviations above the mean height, as the slope formula predicts.
Answer
(a) , so and . (b) For each additional inch of diameter, predicted height increases by 2 feet. (c) feet.
Worked example 2: Using computer output
Question: Hypothetical regression output for 12 cars weighing from 1.8 to 4.6 thousand pounds gives Constant 47.93 and Weight −6.67, with fuel efficiency in miles per gallon. (a) Write the equation. (b) Predict the fuel efficiency of a car weighing 3.2 thousand pounds. (c) Explain why predicting for a 7.5-thousand-pound truck is unwise. (d) Interpret the intercept, if it is meaningful.
What tells you the method
"Constant" gives and the variable's row gives ; a weight outside 1.8 to 4.6 is extrapolation.
Step 1: Equation.
.
WhyThe Coef column holds and .
Step 2: Predict.
miles per gallon.
Why3.2 lies inside the data's range, so the prediction is reasonable.
Step 3: Extrapolation.
At 7.5, the line gives miles per gallon, which is impossible.
Why7.5 is far outside the weights in the data, and the linear pattern cannot continue forever.
Step 4: Intercept.
It would be the predicted efficiency of a car weighing 0 pounds, which cannot exist, so it has no practical meaning here.
Whyis far outside the data.
Check it
The slope is negative, and the 3.2 prediction (26.59) is lower than the intercept, as it should be for a heavier car.
Answer
(a) (b) miles per gallon (c) 7.5 is far outside 1.8 to 4.6, and the prediction, miles per gallon, is impossible. (d) No practical meaning.
Your turn
Question: For five hypothetical players, practice hours has and ; free throws made has and ; . Find the least-squares regression line.
Step 1:
.
Step 2: Your go: use the point of means to find , then write the equation.
Show the full solutionHide the solution
, so .
Answer: , so and .
Traps
Trap
Writing the slope as .
It seems right because comes first in the line. But the slope is the change in per unit of , so the spread goes on top: .
Check yourself
Show answerHide answer
. The value 0.2 inverts the ratio.
Trap
Trusting a prediction because is close to 1.
It seems right because a strong fit looks reliable everywhere. But the fit was only checked inside the data's range; outside it, extrapolation can give nonsense.
Check yourself
Show answerHide answer
Age 40 is far outside 3 to 12, and growth stops in adulthood, so the linear pattern does not continue.
What's examined
Regression lines are tested on the AP® Statistics exam (Two-variable data), in multiple-choice and free-response questions. Expect Calculate, Interpret, Identify and Explain: find the line from summary statistics, read it from computer output, interpret slope and intercept in context, and judge a prediction. The formulas , and are on the formula sheet. Residuals and r² come next: see the note on Residuals, Residual Plots and r².
Practice questions
- Recall Which point is always on the least-squares regression line?
- A)
- B)
- C)
- D) The first data point
Show answer
Answer: B)
Marking points:
- , so the point of means is on the line.
- A holds only if the intercept is 0. C mixes spreads with values. D is on the line only by chance.
- Apply For hypothetical summer days, temperature (°F) has mean 70 and standard deviation 8, iced drinks sold at a café has mean 150 and standard deviation 24, and . Find the least-squares regression line for predicting drinks sold from temperature.
Show answer
Answer: , so and .
Marking points:
- .
- .
- Apply For hypothetical puppies, , with weight in grams and age in weeks. Which is the correct interpretation of 85?
- A) Every puppy gains exactly 85 grams each week.
- B) A newborn puppy weighs 85 grams.
- C) For each additional 85 grams, predicted age increases by 1 week.
- D) For each additional week of age, predicted weight increases by 85 grams.
Show answer
Answer: D) For each additional week of age, predicted weight increases by 85 grams.
Marking points:
- The slope is the predicted change in (weight) for each 1-unit increase in (age).
- A drops "predicted". B confuses the slope with the intercept, 520. C swaps the roles of the variables.
- Apply Hypothetical regression output for minutes of daily exercise () and resting heart rate in beats per minute () shows Constant 78.6 and Exercise −0.24. Predict the resting heart rate for 45 minutes of daily exercise.
Show answer
Answer: The predicted resting heart rate is beats per minute.
Marking points:
- .
- .
- Recall A line was fitted to data on children aged 2 to 10. Using it to predict the height of a 30-year-old is called what?
- A) Extrapolation
- B) Interpolation
- C) A residual
- D) Correlation
Show answer
Answer: A) Extrapolation
Marking points:
- Predicting outside the range of in the data is extrapolation.
- B predicts inside the range. C is for a data point. D measures linear strength.
- Exam-style Hypothetical regression output for hours of study () and quiz score ():
| Predictor | Coef | SE Coef |
|---|---|---|
| Constant | 48.30 | 3.12 |
| Study hours | 1.92 | 0.47 |
Which is the equation of the least-squares line?
- A)
- B)
- C)
- D)
Show answer
Answer: C)
Marking points:
- The Constant row's Coef is ; the Study hours row's Coef is .
- A swaps and . B takes the slope from the SE Coef column. D uses the SE Coef column for both.
- Exam-style For 20 hypothetical apartments, floor area (square feet) has mean 800 and standard deviation 150, monthly heating cost (dollars) has mean 90 and standard deviation 18, and . The areas range from 500 to 1100 square feet. (a) Find the least-squares regression line. (b) Predict the heating cost for 1000 square feet. (c) Should you use the line for a 3000-square-foot house? Explain.
Show answer
Answer: (a) , so and . (b) dollars. (c) No: 3000 is far outside 500 to 1100 square feet, so it would be extrapolation.
Marking points:
- ; .
- .
- The explanation names extrapolation and the data's range.
Key points
Recall, then reveal
Say the main points from memory first, then check them.
Show key pointsHide key points
- The least-squares line minimizes the sum of squared vertical distances and passes through .
- Find first, then .
- Slope: the predicted change in per 1-unit increase in , in context with units; intercept: the prediction at , if that makes sense.
- Predict only inside the range of the data; outside it is extrapolation.
- In computer output, "Constant" gives and the explanatory variable's row gives .