Tutorials › AP Statistics › Prediction Versus Observed Values

Least-squares regression · Tutorial 872 of 1000

Prediction Versus Observed Values

Learn how to find the gap between an observed response and its regression prediction, and explain what that gap means in context.

Intermediate 9 min read

What You'll Learn

  • Match an observed response with the prediction for the same predictor value.
  • Calculate a residual as observed response minus predicted response.
  • Interpret a positive, negative, or zero residual in context.
  • Explain why a residual has the response variable’s units.
  • Distinguish a signed residual from the size of the gap alone.
  • Describe when a residual can be calculated for a case.

Compare the Prediction With the Observation

A regression line gives a predicted response \(\hat{y}\) for a specified predictor value \(x\). For a data point that was actually observed, we can compare that prediction with the case’s observed response \(y\). The difference tells us how far the observed value is from the line and which side of the line it falls on.

In “Strong Correlation Does Not Mean a Good Model,” you met the term residual. Here, we focus on using the residual to describe the gap between one prediction and one observed response. Always match the observed \(y\) with the line’s prediction at that same case’s \(x\). Comparing values from different cases would not describe that case’s prediction gap.

Formula: For an observed data point, the residual is the observed response minus the predicted response: $$ \text{residual}=y-\hat{y}. $$ The residual is a signed difference measured in the response variable’s units.

The order of subtraction matters. A residual is not \(\hat{y}-y\): it is \(y-\hat{y}\). The sign tells you whether the observation is above or below the regression line. The size tells you how far the observation is from its predicted value, measured vertically on a scatterplot.

  • Positive residual: \(y\) is greater than \(\hat{y}\). The point is above the line, and the prediction is lower than the observed response.
  • Negative residual: \(y\) is less than \(\hat{y}\). The point is below the line, and the prediction is higher than the observed response.
  • Zero residual: \(y\) equals \(\hat{y}\). The point lies on the line, so the predicted and observed responses match.

A residual is expressed in the units of \(y\), not \(x\). For example, if the response is travel time in minutes, a residual of \(4\) is \(4\) minutes. It is not a difference of four kilometers, nor is it automatically a percentage. If a response is recorded as a percentage, state whether the difference is in percentage points.

A Reliable Way to Find and Explain the Gap

For each observed case, use this sequence. It makes the comparison clear and helps prevent sign errors.

1
Identify the case and its predictor.
Read the observed \(x\) and \(y\) for the same data point.
2
Find the prediction for that \(x\).
Substitute the case’s predictor value into the regression equation to calculate \(\hat{y}\).
3
Subtract in the correct order.
Calculate \(y-\hat{y}\): observed response minus predicted response.
4
Interpret the signed result.
Give the residual’s units and explain whether the observed response is above or below the prediction.

A prediction by itself is not a residual. For a future case, the actual response is not yet known, so there is no observed \(y\) to subtract. Once that response is observed, the difference can be calculated. A residual therefore describes the gap for an observed case; it does not promise how far a future response will be from its prediction.

Worked Examples

Worked Example: An Observed Travel Time Above the Prediction

A fictional city-planning exercise relates route distance \(x\), in kilometers, to travel time \(y\), in minutes. A fitted regression line is \(\hat{y}=8+3.2x\). One observed route is 6.5 kilometers long and takes 34.0 minutes. Find and interpret the residual for this route.

State. We want to compare this route’s observed travel time \(y=34.0\) minutes with the line’s prediction at its distance \(x=6.5\) kilometers.

Plan. Calculate \(\hat{y}\) by substituting \(x=6.5\) into the equation. Then calculate the residual as observed travel time minus predicted travel time, \(y-\hat{y}\).

Do. The line predicts:

$$ \hat{y}=8+3.2(6.5) =8+20.8 =28.8\text{ minutes}. $$

The residual is:

$$ y-\hat{y}=34.0-28.8=5.2\text{ minutes}. $$

Conclude. This route’s travel time was 5.2 minutes longer than the regression line predicted for a 6.5-kilometer route. The positive residual means the observed point is above the line. It describes this route’s difference from its prediction; it does not mean every route of that distance takes 5.2 minutes longer than predicted.

Worked Example: An Observed Shooting Percentage Below the Prediction

A fictional sports program uses practice time \(x\), in hours per week, to predict a player’s free-throw success rate \(y\), recorded as a percentage. Its regression line is \(\hat{y}=42+1.6x\). A player who practices 10 hours per week has an observed success rate of 53%. Find and interpret this player’s residual.

First find the predicted percentage for \(x=10\):

$$ \hat{y}=42+1.6(10) =42+16 =58\%. $$

Now subtract the predicted response from the observed response:

$$ y-\hat{y}=53-58=-5. $$

The residual is \(-5\) percentage points. It is negative because the observed success rate of 53% is below the predicted success rate of 58%. In context, this player’s observed rate was 5 percentage points lower than the line predicted for a player who practiced 10 hours per week. The residual is not \(-5\) hours: hours are the units of the predictor, while percentage points are the units of the response.

Worked Example: Two Cases With Different Gaps

A fictional technology project predicts device battery life \(y\), in hours, from screen brightness \(x\), measured in brightness units. The fitted line is \(\hat{y}=11.5-0.045x\). Two observed devices were tested at brightness \(x=80\). Device A lasted 8.6 hours, and Device B lasted 7.1 hours. Compare each observed battery life with the line’s prediction.

Because both devices have the same brightness, the line gives them the same predicted battery life:

$$ \hat{y}=11.5-0.045(80) =11.5-3.6 =7.9\text{ hours}. $$

For Device A, the residual is:

$$ 8.6-7.9=0.7\text{ hours}. $$

Device A lasted 0.7 hours longer than predicted, so its point is above the line. For Device B, the residual is:

$$ 7.1-7.9=-0.8\text{ hours}. $$

Device B lasted 0.8 hours less than predicted, so its point is below the line. Although the devices share the same predictor value and therefore the same prediction, their observed responses differ. This illustrates why a regression prediction is not a guarantee that two cases with the same \(x\) will have identical \(y\)-values.

What the Residual Does—and Does Not—Say

A residual summarizes one observed case’s vertical difference from the regression line. Its sign and magnitude are useful, but they answer a limited question: how did this observed response compare with the value predicted by the line at this case’s predictor value?

  • The sign gives direction. A positive residual means the response was greater than predicted; a negative residual means it was less than predicted.
  • The magnitude gives the gap’s size. A residual of \(5\) and a residual of \(-5\) have the same distance from zero, but they point in opposite directions.
  • The units come from the response. Subtract two \(y\)-values, so the residual uses the units in which \(y\) is measured.
  • The residual is case-specific. It compares one observed data point with its own prediction, not the prediction with an unrelated response.
  • A small residual does not prove the model is appropriate. It only says that this case’s observed response is close to the line’s prediction. As discussed in “Strong Correlation Does Not Mean a Good Model,” judge a linear model using the overall data pattern as well, not one point alone.

On a scatterplot, the predicted value \(\hat{y}\) lies on the regression line at the case’s \(x\)-value. The observed value \(y\) is the point’s vertical position. The residual is the signed vertical difference between those two responses. A point above the line has a positive residual; a point below it has a negative residual. This visual connection can help you check the sign of your calculation.

Residuals also do not establish that the predictor caused the response to differ. A residual describes a comparison with a fitted line, not the reason for an individual outcome. Keep the interpretation focused on the observed response and the model’s prediction, consistent with “Why Correlation Does Not Imply Causation.”

Common Mistakes and AP Exam Tips

  • Reversing the subtraction. Writing \(\hat{y}-y\) reverses the sign. A full-credit calculation starts with \(y-\hat{y}\), observed minus predicted.
  • Reporting only the sign. “The residual is positive” is not a complete contextual interpretation. State that the observed response was greater than the predicted response, and include the amount and units.
  • Calling a negative residual a negative response. The response itself might be positive. A negative residual means only that the observed response is less than the prediction.
  • Using predictor units for the gap. The residual uses \(y\)-units. If \(x\) is measured in hours and \(y\) in dollars, the residual is in dollars.
  • Comparing the wrong case and prediction. Calculate \(\hat{y}\) at the observed point’s own \(x\)-value before subtracting.
  • Claiming the prediction is what actually happened. Use wording such as “the line predicted” and “the observed response was.” Do not describe \(\hat{y}\) as the case’s guaranteed outcome.
  • Confusing a residual with an absolute distance. The signed residual preserves whether the point is above or below the line. If you report only the distance, you lose that direction.

For a clear AP-style response, show the predicted value, calculate observed minus predicted, and interpret the sign and amount using the response’s units. Name the case or context so the reader knows what the gap describes.

Key takeaway: For an observed case, calculate the residual with \(y-\hat{y}\). A positive residual means the observed response is above the prediction; a negative residual means it is below. State the gap in the response’s units and describe it as a comparison for that case, not a guaranteed outcome for others.

Check Your Understanding

For each question, compare the observed response with the prediction for the same case.

  1. A line predicts \(y\) in dollars. For one case, \(\hat{y}=46\) dollars and the observed response is \(y=51\) dollars. Calculate and interpret the residual.
  2. A model predicts a response in seconds. For an observed case, \(y=12.4\) seconds and \(\hat{y}=13.1\) seconds. What is the residual, and is the point above or below the line?
  3. A student calculates \(\hat{y}-y=3\) and calls that the residual. What should the student calculate instead, and why might the sign change?
  4. A regression equation predicts a response for a future case, but the actual response has not yet been observed. Can a residual for that case be calculated now? Explain.
  5. A positive residual is 2.5 centimeters. State what that means about the observed response compared with the predicted response.