From a Regression Equation to a Prediction
In “Entering Data and Running LinReg on a TI-84,” you learned how a calculator produces a least-squares regression equation. Now we will use an equation to predict a response for a particular value of the predictor. The calculation is direct: substitute the given \(x\)-value into the equation, evaluate it, and report \(\hat{y}\) with the response variable’s units.
For this tutorial, suppose a fictional bike-rental company uses the regression equation below to predict the duration of a rental trip from the route’s length. Here, \(x\) is route length in kilometers and \(\hat{y}\) is predicted trip duration in minutes. The coefficients and equation are supplied; we are not fitting a new line.
As discussed in “Reading the Equation of a Regression Line,” the hat on \(y\) signals a predicted response. For a specific route length, the value of \(\hat{y}\) is the response predicted by the fitted line. It is not necessarily the actual trip duration for a particular rider. As in “Slope Units and Rates of Change,” the equation’s slope is measured in response units per predictor unit: here, minutes per kilometer. The prediction itself is measured in minutes.
A Reliable Substitution Routine
Before calculating, identify what the input value represents and what the equation predicts. This avoids substituting a response value for \(x\), or attaching predictor units to the answer. Then use parentheses around the substituted value. The parentheses make it clear that the value replaces \(x\), especially when it is a decimal or negative number.
Determine the supplied \(x\)-value and its units. In this setting, \(x\) is route length in kilometers.
Write the regression equation with the given value inside parentheses.
Multiply the slope by the substituted value, then add the intercept.
Use \(\hat{y}\), name the predicted response, and give its units.
Keep the equation’s order of operations: multiply \(2.4\) by the substituted \(x\)-value before adding \(10\). The number \(10\) is the intercept, while \(2.4x\) is the product of the slope and the predictor value. Adding the coefficients first, or multiplying the intercept by \(x\), changes the equation and gives the wrong prediction.
Worked Examples
Worked Example: Predict the Duration for an 8-Kilometer Route
Suppose a rider’s planned route is \(8\) kilometers. Use \(\hat{y}=10+2.4x\) to predict the trip duration.
The predictor value is \(x=8\) kilometers. Substitute \(8\) for \(x\), multiply first, and then add the intercept:
The predicted trip duration for an 8-kilometer route is \(29.2\) minutes. The answer is in minutes because trip duration is the response variable; \(8\) kilometers is the predictor input, not the unit of the prediction.
This is a value predicted by the line, not a guarantee that the rider will take exactly \(29.2\) minutes. A rider’s actual time could differ from the line’s prediction.
Worked Example: Substitute a Decimal Route Length
A different planned route is \(3.5\) kilometers long. Find the predicted trip duration. Keeping the decimal value in parentheses helps show that \(3.5\) replaces \(x\):
For a 3.5-kilometer route, the line predicts a trip duration of \(18.4\) minutes. The substitution uses the slope, \(2.4\) minutes per kilometer, multiplied by \(3.5\) kilometers; the resulting \(8.4\) is in minutes. Adding the intercept of \(10\) minutes gives the predicted duration.
Be careful not to report \(8.4\) minutes as the prediction. That is only the product \(2.4(3.5)\); the full equation also includes the intercept.
Worked Example: Predict at a Predictor Value of Zero
What does the equation predict for a route length of \(0\) kilometers? Substitute zero just as you would any other predictor value:
At \(x=0\) kilometers, the equation predicts a trip duration of \(10\) minutes. The slope term becomes zero, but the intercept remains. This calculation illustrates the equation’s value at \(x=0\), consistent with the meaning of the intercept explained in “Interpreting the Y-Intercept in Context.” Whether a route of zero kilometers is a useful real-world prediction is a separate question from how to evaluate the equation.
What the Prediction Does—and Does Not—Say
The calculation gives the response value on the regression line for the chosen predictor value. The actual response for an individual case may be higher or lower. As explained in “Predicted Change Versus Actual Change,” a line describes predicted responses; it does not say that every observed response changes by exactly the slope amount.
The predictor value also matters. A regression line was fitted using particular observed cases. If you are given the original data or the range of predictor values used to fit the line, check whether the requested \(x\)-value is within that range. Predicting within the observed range is called interpolation. Predicting beyond it is called extrapolation; the line may not describe the relationship reliably that far beyond the data. The equation by itself does not tell us the observed range, so do not claim a prediction is interpolation or extrapolation without that information.
This check does not change the arithmetic. You can substitute and evaluate any numerical \(x\)-value in the equation, but a numerically correct result is not automatically a trustworthy real-world prediction. The interpretation should match what is known about the data and the setting.
Common Mistakes and AP Exam Tips
A strong response makes the substitution visible and finishes with a contextual statement. These are common errors to avoid:
- Using the wrong input. Substitute the value of the predictor \(x\), not a response value or a predicted value from another question.
- Ignoring the intercept. The prediction is \(10+2.4x\), not just \(2.4x\). Show both the multiplication and the addition.
- Changing the order of operations. Multiply \(2.4\) by the substituted value first; then add \(10\).
- Leaving off units. The calculated \(\hat{y}\) is a predicted trip duration, so report minutes—not kilometers.
- Calling the prediction an actual result. Say “the line predicts” or “the predicted duration is.” Do not claim the rider’s actual trip will take exactly that long.
- Reporting only an unexplained number. A full response identifies the predictor value and states what the result represents in context.
- Assuming every prediction is equally reliable. If the observed \(x\)-range is available, consider whether the requested value is beyond it before making a real-world claim.
For example, a complete response to the first worked example says: “For a route length of 8 kilometers, the regression equation predicts a trip duration of 29.2 minutes.” This names the predictor and its value, gives the predicted response, and includes the response units. It does not overstate the prediction as an observed or guaranteed trip time.
Check Your Understanding
Use \(\hat{y}=10+2.4x\), where \(x\) is route length in kilometers and \(\hat{y}\) is predicted trip duration in minutes.
- What trip duration does the line predict for a route that is \(5\) kilometers long? Show the substitution and report units.
- For a route length of \(12.5\) kilometers, what is the predicted duration? Write the multiplication and addition separately.
- Why is \(2.4x\) by itself not the complete prediction?
- For \(x=0\), what is \(\hat{y}\), and what does this value describe according to the equation?
- If a route’s actual duration differs from the value predicted by the line, does that make the substitution calculation incorrect? Explain briefly.