Linear Regression Models
How a regression line ŷ = a + bx uses an explanatory variable to predict a response, how to compute and read predictions, and why predictions inside the data (interpolation) are more reliable than outside it (extrapolation).
When a scatterplot looks linear, a linear regression model summarizes it with a line, \(\hat{y} = a + bx\). Plug in a value of the explanatory variable \(x\) to get \(\hat{y}\), the predicted response. Predictions are most trustworthy for x-values inside the range of the data (interpolation) and become less reliable the farther they go outside it (extrapolation).
1The model
If the form of the relationship between \(x\) and \(y\) appears linear, a linear regression model approximates it with the equation
where \(\hat{y}\) (“y-hat”) is the predicted response, \(a\) is the y-intercept, \(b\) is the slope, and \(x\) is the explanatory variable. The hat matters: \(y\) is an actual observed value, \(\hat{y}\) is what the model predicts.
Used cars
Regression software reports the table below. Write the equation of the regression line in context.
| Predictor | Coef |
|---|---|
| Constant | 25.688 |
| Age | −1.583 |
- 1The Constant row gives the y-intercept a; the row for the explanatory variable gives the slope b.
- 2Use words for the variables, with a hat on the predicted response.
Writing “price = 25.69 − 1.583(age)” claims every car’s price is exactly on the line. Real prices scatter around it. Write “predicted price” or \(\hat{y}\).
2Making predictions
To predict, substitute the x-value into the equation. Give the answer in context and in the units of the response.
Used cars
The regression line for the 12 used cars is \(\hat{y} = 25.69 - 1.583x\), where \(x\) is age in years and \(\hat{y}\) is predicted price in thousands of dollars. Predict the price of a 6-year-old car.
- 1Substitute \(x = 6\): \(\hat{y} = 25.69 - 1.583(6) = 25.69 - 9.498 = 16.19\).
- 26 is inside the ages used to build the model (1 to 10), so this is interpolation.
“The model predicts that a 6-year-old car of this model will sell for about 16.19 thousand dollars.”
The line predicts price from age, not age from price. To estimate age from a known price, you would need a different regression with price as the explanatory variable.
3Interpolation and extrapolation
| Term | Meaning | Reliability |
|---|---|---|
| Interpolation | Predicting for an x-value within the interval of x-values used to build the line | Reasonable when the model fits |
| Extrapolation | Predicting for an x-value beyond that interval | Less reliable the farther it goes |
Used cars
Use the model to predict prices for cars aged 4.5 years and 18 years. Which prediction should you trust more?
- 1Age 4.5: inside 1 to 10, interpolation. \(\hat{y} = 25.69 - 1.583(4.5) \approx 18.57\).
- 2Age 18: beyond 10, extrapolation. \(\hat{y} = 25.69 - 1.583(18) \approx -2.80\), a negative price.
Cars cannot lose 1.583 thousand dollars every year forever; prices level off near scrap value. A line that fits ages 1 to 10 says nothing reliable about age 18.
This line was built from one car model. Using it to price a different model, even of the same age, is a form of extrapolation: those cars were never in the data.
Quick reference
| Piece | Meaning |
|---|---|
| \(\hat{y} = a + bx\) | Linear regression model |
| \(\hat{y}\) | Predicted response (not the actual y) |
| \(a\) | y-intercept: predicted y when x = 0 |
| \(b\) | Slope: change in predicted y for each one-unit increase in x |
| Interpolation | x inside the data range: more trustworthy |
| Extrapolation | x outside the data range: less reliable |