Tutorials › Regression Analysis (Undergraduate) › The Simple-Regression Prediction-Interval Formula

Prediction Intervals for New Outcomes · Tutorial 720 of 991

The Simple-Regression Prediction-Interval Formula

Build a prediction interval for one future outcome by combining the fitted value, residual standard error, leverage at the predictor value, and a t critical value.

Intermediate 10 min read

What You'll Learn

  • State the simple linear regression conditions underlying a t prediction interval.
  • Distinguish the residual standard error from the standard error for predicting a new outcome.
  • Calculate the predictor-dependent leverage term from \(n\), \(\bar{x}\), \(x_0\), and \(S_{xx}\).
  • Construct a two-sided prediction interval using a t critical value.
  • Interpret the interval as a range for one future response at a specified predictor value.
  • Identify common calculation and interpretation errors.

Why Predicting One New Outcome Needs Its Own Interval

A fitted regression line gives a point prediction at a chosen predictor value. But a future response will generally differ from that fitted value: the line estimates the conditional mean, while an individual outcome also contains its own random error. A prediction interval accounts for both sources of uncertainty. This tutorial develops the two-sided t prediction-interval formula for simple linear regression and shows how to use its components.

The interval is for one future response at a specified predictor value \(x_0\). It is not an interval for the mean response at \(x_0\). The extra variation associated with the new outcome is reflected in the formula’s leading \(1\) under the square root.

Model, Conditions, and Notation

Suppose the observed responses \(Y_1,\ldots,Y_n\) are related to predictor values \(x_1,\ldots,x_n\) by the simple linear regression model

$$ Y_i=\beta_0+\beta_1x_i+\varepsilon_i,\qquad i=1,\ldots,n. $$

For the usual t-based prediction interval, assume the mean response is linear in \(x_i\), the errors are independent with mean \(0\) and common variance \(\sigma^2\), and the errors are normally distributed. For predicting a new response, also assume the future error is independent of the errors used to fit the line and has the same variance. These conditions make the formula appropriate for predicting a new outcome from the same process at \(x_0\).

Let \(\hat{y}_0=\hat{\beta}_0+\hat{\beta}_1x_0\) be the fitted value at \(x_0\), and define

$$ \bar{x}=\frac{1}{n}\sum_{i=1}^n x_i,\qquad S_{xx}=\sum_{i=1}^n(x_i-\bar{x})^2,\qquad s=\sqrt{\frac{\mathrm{SSE}}{n-2}}. $$

Here \(s\) is the residual standard error, an estimate of the standard deviation \(\sigma\) of the regression errors. The quantity

$$ h_0=\frac{1}{n}+\frac{(x_0-\bar{x})^2}{S_{xx}} $$

is the predictor-dependent leverage term for estimating the mean at \(x_0\). Its value depends on where \(x_0\) lies relative to the observed predictor values and their spread.

Definition: A two-sided \(100(1-\alpha)\%\) t prediction interval for one new response at \(x_0\) is a range centered at \(\hat{y}_0\), with margin of error equal to a t critical value times the estimated standard error for predicting that new response. In simple linear regression, the estimated prediction standard error is \(s\sqrt{1+h_0}\).

The Simple-Regression Prediction-Interval Formula

With \(n-2\) degrees of freedom, let \(t_{1-\alpha/2,n-2}\) denote the positive t critical value with upper-tail probability \(\alpha/2\). The two-sided prediction interval is

$$ \hat{y}_0 \ \pm\ t_{1-\alpha/2,n-2}\, s\sqrt{1+\frac{1}{n}+\frac{(x_0-\bar{x})^2}{S_{xx}}}. $$

Equivalently, the lower and upper endpoints are

$$ \left( \hat{y}_0-t_{1-\alpha/2,n-2}s\sqrt{1+h_0}, \quad \hat{y}_0+t_{1-\alpha/2,n-2}s\sqrt{1+h_0} \right). $$

The \(1\) inside the square root accounts for the error in the new outcome. The remaining terms, \(1/n+(x_0-\bar{x})^2/S_{xx}\), account for uncertainty in the fitted mean at that predictor value. The residual standard error \(s\) scales both contributions into the response’s units.

Why the Prediction Standard Error Has This Form

Write the future response as \(Y_{\mathrm{new}}=\beta_0+\beta_1x_0+\varepsilon_{\mathrm{new}}\). Its prediction error is the difference between that response and the fitted value:

$$ Y_{\mathrm{new}}-\hat{y}_0 = \varepsilon_{\mathrm{new}} +\bigl(\beta_0+\beta_1x_0-\hat{y}_0\bigr). $$

The first term is the new outcome’s random error. The second is the error from estimating the conditional mean with the fitted line. Under the model conditions, the new error is independent of the estimation errors. The variance of the new error is \(\sigma^2\), and the variance of the fitted-mean estimation error at \(x_0\) is \(\sigma^2h_0\). Therefore the prediction-error variance is the sum:

$$ \operatorname{Var}(Y_{\mathrm{new}}-\hat{y}_0) = \sigma^2+\sigma^2h_0 = \sigma^2(1+h_0). $$

Replacing the unknown \(\sigma\) by the residual standard error \(s\) gives the estimated prediction standard error \(s\sqrt{1+h_0}\). The t multiplier calibrates this estimated standard error for the interval. In simple linear regression, fitting the intercept and slope leaves \(n-2\) residual degrees of freedom. The details of t-based calibration are a separate topic; here, the critical value is used as part of the formula.

Worked Example: Predicting at the Sample Mean

Consider a hypothetical regression of a laboratory measurement, in points, on a quantitative predictor. The fitted value at \(x_0=\bar{x}\) is \(20\) points, the residual standard error is \(s=4\) points, and the fit used \(n=10\) observations. Construct a 95% prediction interval for one new measurement at \(x_0=\bar{x}\). Use \(t_{0.975,8}\approx2.306\).

Because \(x_0=\bar{x}\), the squared-distance term is zero. The leverage term is

$$ h_0=\frac{1}{10}+\frac{(\bar{x}-\bar{x})^2}{S_{xx}}=0.1. $$

The estimated prediction standard error is

$$ s\sqrt{1+h_0}=4\sqrt{1.1} \approx4(1.048809) \approx4.195\ \text{points}. $$

The margin of error, calculated before rounding the standard error, is

$$ 2.306(4\sqrt{1.1})\approx9.674\ \text{points}. $$

Thus the interval is \(20\pm9.674\), or approximately \((10.33,\ 29.67)\) points. Under the model conditions, this procedure gives a 95% prediction interval for one new measurement at the sample mean predictor value. The interval concerns a future individual measurement, not the mean measurement at that predictor value.

Working Through the Predictor-Dependent Term

Away from \(\bar{x}\), the squared-distance term increases \(h_0\). It is important to use the predictor values in the same units as the fitted regression and to square the difference \(x_0-\bar{x}\). The next example makes those steps explicit.

Worked Example: Predicting Away From the Predictor Mean

A hypothetical regression predicts a response in minutes from a predictor measured in units. Suppose \(n=12\), \(\bar{x}=50\), \(S_{xx}=1100\), and \(s=3\) minutes. At \(x_0=60\), the fitted value is \(\hat{y}_0=72.5\) minutes. Construct a 95% prediction interval using \(t_{0.975,10}\approx2.228\).

First calculate the leverage term:

$$ h_0=\frac{1}{12}+\frac{(60-50)^2}{1100} =\frac{1}{12}+\frac{100}{1100} \approx0.08333+0.09091 =0.17424. $$

Then calculate the estimated prediction standard error:

$$ SE_{\mathrm{pred}} =3\sqrt{1+0.17424} =3\sqrt{1.17424} \approx3.251\ \text{minutes}. $$

Using the unrounded intermediate values, the margin of error is approximately \(2.228(3.2509)=7.243\) minutes. The interval is

$$ 72.5\pm7.243=(65.257,\ 79.743)\ \text{minutes} \approx(65.26,\ 79.74)\ \text{minutes}. $$

The interval predicts one future response, in minutes, for a case with predictor value \(60\). The predictor’s distance from its sample mean contributes to the width through \(h_0\).

A Second Calculation and a Reporting Pitfall

The formula has several components, so it helps to keep the sequence consistent: find \(h_0\), add \(1\), multiply its square root by \(s\), and then multiply by the t critical value. The response units belong on the prediction standard error, margin of error, and interval endpoints.

Worked Example: Keeping the Components and Units Straight

Suppose a hypothetical regression predicts a crop measurement in centimeters. Its summary values are \(n=16\), \(\bar{x}=4\), \(S_{xx}=60\), and \(s=2.5\) cm. At \(x_0=7\), the fitted value is \(18\) cm. For a 95% prediction interval, use \(t_{0.975,14}\approx2.145\).

The leverage term is

$$ h_0=\frac{1}{16}+\frac{(7-4)^2}{60} =0.0625+\frac{9}{60} =0.2125. $$

The prediction standard error is

$$ SE_{\mathrm{pred}} =2.5\sqrt{1+0.2125} =2.5\sqrt{1.2125} \approx2.753\ \text{cm}. $$

The margin of error is approximately \(2.145(2.7528)=5.905\) cm. Therefore,

$$ 18\pm5.905=(12.095,\ 23.905)\ \text{cm} \approx(12.10,\ 23.90)\ \text{cm}. $$

The calculation retains the \(1\) for the new outcome, and the reported limits are in centimeters because the fitted response and residual standard error are in centimeters.

Common Mistakes and a Reliable Procedure

A frequent error is to use only \(s\sqrt{h_0}\) as the prediction standard error. That expression leaves out the new outcome’s own variation. For an individual future response, use \(s\sqrt{1+h_0}\). Another mistake is to treat the fitted value as the entire prediction: \(\hat{y}_0\) is the interval’s center, not a guarantee of the future response.

A useful calculation sequence is:

1
Identify the target.
Specify the predictor value \(x_0\) and confirm that the goal is an interval for one new response.
2
Find the fitted value and leverage.
Calculate \(\hat{y}_0\) and \(h_0=1/n+(x_0-\bar{x})^2/S_{xx}\).
3
Calculate the prediction standard error.
Use \(s\sqrt{1+h_0}\), including the leading \(1\).
4
Apply the t critical value.
Multiply the prediction standard error by \(t_{1-\alpha/2,n-2}\), then add and subtract the margin from \(\hat{y}_0\).
5
Report in context.
Give the interval’s response units and state that it predicts one new response at \(x_0\).

Do not describe a 95% interval as having a 95% probability of containing a particular fixed future value after the interval has been calculated. The confidence level describes the long-run performance of the interval procedure under its assumptions. For a specific prediction, report the calculated range and the case to which it applies.

Key takeaway: In simple linear regression, a two-sided t prediction interval for one new response at \(x_0\) is \(\hat{y}_0\pm t_{1-\alpha/2,n-2}s\sqrt{1+1/n+(x_0-\bar{x})^2/S_{xx}}\). The leading \(1\) represents new-outcome variation; the remaining terms represent uncertainty in the fitted mean.

Check Your Understanding

Use the formula and explanations above to answer these questions.

  1. In the simple-regression prediction standard error, what does the leading \(1\) under the square root account for?
  2. For a fixed fitted regression, how does \(h_0\) simplify when \(x_0=\bar{x}\)?
  3. A student uses \(s\sqrt{h_0}\) rather than \(s\sqrt{1+h_0}\) for a new response. What component has been omitted?
  4. For a two-sided 95% prediction interval based on \(n=14\) observations, what degrees of freedom index the t critical value?
  5. In context, what is the difference between the future quantity covered by a prediction interval and the fitted value at \(x_0\)?