AP Statistics · Topic 5.3 · Reading guide, about 6 min

Predicting with a line, and extrapolation

Use a linear regression equation to predict y-hat, and tell safe interpolation from unreliable extrapolation.

In one minute

When a scatterplot is roughly linear, a straight line can summarize the pattern and let you predict the response for a given explanatory value. This line is called a regression line, and its equation is written y^=a+bx\hat{y} = a + bx.

Prediction is useful but only within limits. Predicting inside the range of the data is generally sensible; predicting far outside it can give nonsense.

Key terms

Linear regression model
A line, y^=a+bx\hat{y} = a + bx, used to describe and predict the relationship between an explanatory variable x and a response variable y.
Predicted value y^\hat{y}
The value of the response the line gives for a particular x. The hat means predicted, not observed.
Intercept a
The predicted y when x=0x = 0.
Slope b
The predicted change in y for each one-unit increase in x.
Interpolation
Predicting y for an x-value inside the range of the observed x-values.
Extrapolation
Predicting y for an x-value outside the range of the observed data. It becomes less reliable the further outside you go.
Explanatory and response
x is the explanatory variable (what you plug in) and y the response (what you predict). Define both in context.
Linear pattern
A scatterplot in which the points follow a roughly straight band. The line is appropriate only for such patterns.

The regression equation

The model is y^=a+bx\hat{y} = a + bx. The number a is the intercept, where the line crosses the vertical axis at x=0x = 0. The number b is the slope, the amount y^\hat{y} changes when x increases by 1. Always write y^\hat{y} rather than y, since the line gives predictions, not the exact outcomes, and always define x and y in the context with units.

For example: y^=24.8−1.9x\hat{y} = 24.8 - 1.9x, where x is a used car's age in years and y^\hat{y} is its predicted price in thousands of dollars. The slope −1.9-1.9 means that for each additional year of age, the predicted price drops by about 1.9 thousand dollars, or 1,900 dollars. The intercept 24.8 is the predicted price at age 0, a brand new car, about 24,800 dollars.

Reading slope and intercept as a rate and a starting value

Think of the slope as a rate of change and the intercept as a starting value. In y^=24.8−1.9x\hat{y} = 24.8 - 1.9x, the rate is a drop of 1.9 per year, and the starting value is 24.8 at age 0. A positive slope means the predicted response rises as x rises, and a negative slope means it falls. The size of the slope depends on the units: measuring price in dollars instead of thousands would multiply both a and b by 1,000 without changing the pattern at all.

When you interpret either number, use words such as "predicted" or "on average." The line describes the trend in the group, not what happens to each individual. Two cars of the same age can differ by thousands of dollars, and the line gives only the typical price for that age. Also check whether the intercept makes sense. It is the prediction at x=0x = 0, which may be outside the data, in which case it is an extrapolation and may carry no real meaning.

Making predictions

To predict, substitute the x-value into the equation. Keep units in mind and state the answer in the context. Remember that the line predicts an average-like value, not a certain outcome: real cars of the same age differ in price.

Before predicting, confirm that the scatterplot looks linear. A line fitted to a curved pattern can give misleading predictions even inside the data range.

Interpolation versus extrapolation

The data you used to build the line cover a particular range of x-values. Predicting inside that range is interpolation, and it is generally reasonable if the pattern is linear. Predicting outside the range is extrapolation, which assumes the same linear pattern continues beyond what you observed. It might not. A child's height rises roughly linearly through the early years, but a line fitted to ages 3 to 10 would predict absurd heights at age 40.

The further the x-value is from the data, the less trustworthy the prediction. Slight extrapolation might be acceptable with caution; large extrapolation is not.

Interpolation versus extrapolation
QuestionInterpolationExtrapolation
x-value relative to dataInside the observed rangeOutside the observed range
ReliabilityGenerally reasonable if the pattern is linearIncreasingly unreliable
What it assumesThe pattern holds between observed pointsThe pattern continues beyond the data

Worked example

A dealer (invented data) records the age (years) and asking price (thousands of dollars) of six used cars of one model, with ages 1, 2, 3, 5, 6 and 8. A scatterplot is roughly linear and negative. A regression gives y^=24.8−1.9x\hat{y} = 24.8 - 1.9x, where x is age in years and y^\hat{y} is predicted price in thousands of dollars.

Interpolation: predict the price of a 4-year-old car. Age 4 lies between 1 and 8, so this is interpolation. y^=24.8−1.9(4)=24.8−7.6=17.2\hat{y} = 24.8 - 1.9(4) = 24.8 - 7.6 = 17.2. The predicted price is about 17.2 thousand dollars, or 17,200 dollars.

Another interpolation: for a 7-year-old car, y^=24.8−1.9(7)=24.8−13.3=11.5\hat{y} = 24.8 - 1.9(7) = 24.8 - 13.3 = 11.5, about 11,500 dollars.

Extrapolation: predict the price of a 15-year-old car. Age 15 is far above the largest age, 8, so this is extrapolation. y^=24.8−1.9(15)=24.8−28.5=−3.7\hat{y} = 24.8 - 1.9(15) = 24.8 - 28.5 = -3.7, a negative price of 3,700 dollars, which is impossible. The model has stopped being valid: cars do not lose value in a straight line forever, and prices level off. The right response is not to trust the line at that age.

Conclusion: the line is a helpful summary for cars aged about 1 to 8 years, but it should not be used for a 15-year-old car.

How it connects

  • Back to 5.1: you must first check that the scatterplot looks linear before fitting a line.
  • Back to 5.2: a strong r supports a linear model, but it does not guarantee that predictions will be exact.
  • Forward to 5.4 and 5.5: residuals measure how far observed values are from predictions, and technology finds the best line.

Common mistakes

  • **Writing y instead of y^\hat{y}.** The equation gives predictions, so use y^\hat{y}.
  • Extrapolating without comment. Check whether the x-value is within the observed range, and warn when it is not.
  • Forgetting units or context. Say "predicted price in thousands of dollars" rather than just "17.2."
  • Fitting a line to a curve. The model is appropriate only when the scatterplot is roughly linear.

How it shows up on the exam

  • A regression equation and context, asking you to predict at a given x and explain whether it is interpolation or extrapolation.
  • A question asking you to explain why a prediction outside the data range may be unreliable, with a specific reason.
  • A short written explanation of the meaning of the slope and intercept in the equation, with units.

Check yourself

  1. Given y^=12.1+0.6x\hat{y} = 12.1 + 0.6x, predict y when x=10x = 10, and state what 12.1 and 0.6 mean.
  2. The data cover x from 2 to 9. Which of x = 5 and x = 20 are you more willing to predict, and why?
  3. Why does the equation use y^\hat{y} and not y?
  4. What might go wrong if you predict well outside the range of data for a growth process that levels off?

Practice this topic. AP Practice questions on exactly what this lesson covers, with an explanation for every answer.