---
title: "The line predicts y from x. | FiveStudy"
description: "A dealer has eight used pickup trucks of the same model. For each one she records age in years and asking price in thousands of dollars. A customer asks what a seven-year-old truck would cost. The lot"
url: https://fivestudy.com/guides/apstats-5-3-linear-regression-models
---

[AP Statistics](https://fivestudy.com/ap-statistics) · Study guide

# The line predicts y from x.

[Figure: FiveStudy]

FiveStudy

AP® Statistics · Unit 5 · Regression Analysis

AP® Statistics · Unit 5 · Regression Analysis

# 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).

1. The model 2. Making predictions 3. Interpolation and extrapolation

The idea in one paragraph

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).

## 1 The model

If the form of the relationship between \(x\) and \(y\) appears linear, a linear regression model approximates it with the equation

\[ \hat{y} = a + bx \]

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.

**Figure 1.** In ŷ = a + bx, a is the y-intercept (the predicted y when x = 0) and b is the slope (the change in ŷ for each one-unit increase in x). Here every extra year of age lowers the predicted price by 1.583 thousand dollars.

Worked Example 1 Read the model from output

### 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 |

1. 1The Constant row gives the y-intercept a; the row for the explanatory variable gives the slope b.
2. 2Use words for the variables, with a hat on the predicted response.

**Answer:** Predicted price = 25.688 − 1.583(age), with price in thousands of dollars and age in years.

Common Mistake 1 · Leaving the hat off

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}\).

## 2 Making predictions

To predict, substitute the x-value into the equation. Give the answer in context and in the units of the response.

**Figure 2.** To predict, go up from the x-value to the line, then read the y-value. For a 6-year-old car the model predicts ŷ = 25.69 − 1.583(6) = 16.19 thousand dollars.

Worked Example 2 Make a prediction

### 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.

1. 1Substitute \(x = 6\): \(\hat{y} = 25.69 - 1.583(6) = 25.69 - 9.498 = 16.19\).
2. 26 is inside the ages used to build the model (1 to 10), so this is interpolation.

**Answer:** The model predicts a price of about 16.19 thousand dollars for a 6-year-old car.

Say it like this

“The model predicts that a 6-year-old car of this model will sell for about 16.19 thousand dollars.”

Common Mistake 2 · Solving backward for x

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.

## 3 Interpolation 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 |

**Figure 3.** The line was built from cars aged 1 to 10 years. Predictions inside that range are interpolation. Beyond it the line keeps falling, and by about 16 years it predicts a price below zero, which is impossible: extrapolation becomes less reliable the farther it goes.

Worked Example 3 Interpolation or extrapolation?

### Used cars

Use the model to predict prices for cars aged 4.5 years and 18 years. Which prediction should you trust more?

1. 1Age 4.5: inside 1 to 10, interpolation. \(\hat{y} = 25.69 - 1.583(4.5) \approx 18.57\).
2. 2Age 18: beyond 10, extrapolation. \(\hat{y} = 25.69 - 1.583(18) \approx -2.80\), a negative price.

**Answer:** Trust the 4.5-year prediction. The 18-year prediction is extrapolation far beyond the data, and its impossible negative value shows the pattern does not continue.

Common Mistake 3 · Assuming the pattern continues forever

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.

Common Mistake 4 · Using the model for different individuals

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 |

FiveStudy AP® Statistics · Linear regression models
