Tutorials › Regression Analysis (Undergraduate) › Computing Intervals from Regression Software Output

Prediction Intervals for New Outcomes · Tutorial 738 of 991

Computing Intervals from Regression Software Output

Translate common regression output into a prediction interval, and check whether its standard error, degrees of freedom, endpoints, and stated level are consistent.

Intermediate 10 min read

What You'll Learn

  • Locate the fitted value and residual scale in common regression output.
  • Distinguish the standard error for a fitted mean from the standard error for a new outcome.
  • Identify the residual degrees of freedom used for a prediction interval.
  • Calculate and interpret prediction-interval endpoints from software output.
  • Check a reported prediction level using the interval margin and the appropriate \(t\) critical value.

Introduction

Regression software may display a prediction and an interval in a compact table, but the labels are not always self-explanatory. A value called “standard error,” for example, might describe uncertainty in the estimated mean response or uncertainty in a new individual outcome. Those are different quantities, and confusing them can produce an interval that is too narrow.

This tutorial gives a systematic way to read and check software output for a prediction interval. The central tasks are to identify the fitted value, the residual scale, the prediction standard error, the residual degrees of freedom, and the interval endpoints—and then to see whether those numbers agree with the reported prediction level.

The Model and the Prediction-Interval Formula

Consider a standard linear regression model with an intercept and \(k\) predictors. For observation \(i\), write the model as

$$ Y_i=\beta_0+\beta_1x_{i1}+\cdots+\beta_kx_{ik}+\varepsilon_i. $$

For the usual exact \(t\)-based prediction interval, assume the mean response is correctly represented by this linear model, the errors are independent and normally distributed with mean zero and common variance \(\sigma^2\), and the new predictor values are treated as fixed. The fitted model must also be estimable: its regression coefficients are identifiable from the training data.

Definition: At a specified predictor profile \(x_0\), the fitted value \(\hat{y}_0\) is the regression model’s estimated mean response. A prediction interval for a new outcome at \(x_0\) allows for both uncertainty in that estimated mean and the random error in the new outcome.

Let \(h_0\) denote the leverage for the specified predictor profile, and let \(s\) be the residual standard error, the estimate of the error standard deviation. Under the stated model, the standard error for predicting a new outcome is \(s\sqrt{1+h_0}\). The \(1\) accounts for the new outcome’s own error; \(h_0\) accounts for uncertainty in the fitted mean.

$$ SE_{\mathrm{pred}}=s\sqrt{1+h_0}, \qquad \hat{y}_0\ \pm\ t^*SE_{\mathrm{pred}}. $$

Here \(t^*\) is the positive critical value from a \(t\) distribution with the residual degrees of freedom. With \(n\) training observations and \(k\) predictors plus an intercept, those degrees of freedom are \(df=n-k-1\). For a two-sided prediction interval with stated level \(100(1-\alpha)\%\), \(t^*=t_{1-\alpha/2,df}\). Software may calculate \(SE_{\mathrm{pred}}\) internally; it need not print \(h_0\).

Why the Prediction Standard Error Has This Form

A short derivation clarifies what to look for in output. At the new predictor profile, let \(Y_{\mathrm{new}}\) be the outcome to predict. Its prediction error is the difference between the actual new outcome and the fitted value. That difference contains two sources of variation: the new observation’s error and the estimation error in the fitted mean.

$$ Y_{\mathrm{new}}-\hat{y}_0 = \varepsilon_{\mathrm{new}}+ \bigl(\mu_0-\hat{y}_0\bigr), $$

where \(\mu_0\) is the model’s true mean response at the specified profile. The new error is independent of the training data, so its variance adds to the variance of the estimated mean. The first variance is \(\sigma^2\); the second is \(\sigma^2h_0\). Therefore,

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

Replacing \(\sigma\) with \(s\) gives \(SE_{\mathrm{pred}}=s\sqrt{1+h_0}\). Under the normal-error model, the residual variance estimate has \(df\) degrees of freedom, giving the \(t\) critical value in the interval formula. This explains why using only the standard error for the fitted mean leaves out the new outcome’s error.

Translating Software Labels

Output formats differ, so read the labels and the procedure that produced the table rather than relying on column position alone. A typical prediction table may include a fitted value, an interval’s lower and upper limits, and possibly one or more standard errors.

Software label or quantityWhat to check
Fit, fitted value, or predicted meanThis is \(\hat{y}_0\), the center of the interval in an ordinary two-sided \(t\)-based prediction interval.
Residual standard error, residual SD, or an equivalent scale estimateCheck whether it estimates \(\sigma\) using \(\sqrt{SSE/df}\). Some software’s “RMSE” instead uses a different denominator.
SE for the mean or standard error of fitThis measures uncertainty in the estimated mean response, not the full standard error for a new outcome.
Prediction SE or standard error for a new observationThis includes both mean-estimation uncertainty and new-outcome error.
Residual dfFor the standard full-rank model with an intercept and \(k\) predictors, check against \(n-k-1\).
Lower and upper limitsCheck their midpoint and margin against the fit, prediction SE, critical value, and stated level.

The name “RMSE” is not enough to identify the residual scale convention. If a program reports \(\sqrt{SSE/n}\), that value is not the usual \(s=\sqrt{SSE/df}\). In that case, use the software’s documented method or convert the scale when \(SSE\) and the relevant degrees of freedom are known. Also check that the interval requested was a prediction interval, not a confidence interval for the mean. A bootstrap prediction interval, for example, need not be calculated with the \(t\)-formula above.

Worked Example: Checking a Simple-Regression Output Table

Hypothetical output. A simple linear regression uses \(n=24\) training observations. For one new predictor value, the software gives a fitted value of 62.5 units, a residual standard error of 4.8 units, leverage \(h_0=0.10\), and a 95% prediction interval from 52.1 to 72.9 units. Check the interval.

There is one predictor, so \(k=1\) and \(df=24-1-1=22\). The residual standard error is the estimate \(s\), in the same outcome units as the response. The reported prediction standard error can be reconstructed as

$$ SE_{\mathrm{pred}}=4.8\sqrt{1+0.10} =4.8\sqrt{1.10} \approx 5.035\text{ units}. $$

For a 95% two-sided interval with 22 degrees of freedom, \(t^*\approx2.074\). The margin is therefore

$$ 2.074(5.035)\approx10.44\text{ units}. $$

The calculated endpoints are \(62.5-10.44=52.06\) and \(62.5+10.44=72.94\) units. Rounded to one decimal place, these are 52.1 and 72.9 units, matching the software output. The interval is centered at the fitted value, and its margin is consistent with the reported 95% level.

Checking the Degrees of Freedom and the Reported Level

A level check needs the prediction standard error and the correct residual degrees of freedom. If the software prints the standard error directly, use that value. If it prints leverage and the residual standard error instead, calculate the prediction standard error from \(s\sqrt{1+h_0}\). Then compare the interval’s margin with the margin implied by the stated level.

For endpoints \(L\) and \(U\), the midpoint is \((L+U)/2\), and the margin is \((U-L)/2\). For a symmetric \(t\)-based prediction interval, the midpoint should agree with \(\hat{y}_0\), allowing for rounding. Divide the margin by \(SE_{\mathrm{pred}}\). The result should be approximately \(t_{1-\alpha/2,df}\) for the stated two-sided level. Alternatively, the ratio indicates which \(t\) critical value—and thus which level—is consistent with the printed endpoints.

Worked Example: Identifying the Level From Rounded Endpoints

Hypothetical output. A simple regression uses \(n=16\) training observations. At a specified profile, the fitted value is 30.00 units, the residual standard error is 3.20 units, and the leverage is \(0.25\). The software prints prediction limits of 22.33 and 37.67 units, but the level label is missing. What level is consistent with the output?

First, \(df=16-1-1=14\). The prediction standard error is

$$ SE_{\mathrm{pred}} =3.20\sqrt{1+0.25} =3.20\sqrt{1.25} \approx3.578\text{ units}. $$

The printed midpoint is \((22.33+37.67)/2=30.00\) units, so the limits are centered at the fitted value. Their margin is \((37.67-22.33)/2=7.67\) units. The implied critical value is

$$ \frac{7.67}{3.578}\approx2.144. $$

For \(df=14\), the 95% two-sided critical value is approximately 2.145. The implied value is essentially the same; the small difference is due to rounding the displayed limits. Thus the endpoints are consistent with a 95% prediction interval, not with a level inferred merely from their width without considering the degrees of freedom.

Worked Example: Separating Mean and Prediction Standard Errors

Worked Example: Separating Mean and Prediction Standard Errors

Hypothetical output. A multiple regression has \(n=40\) training observations and \(k=3\) predictors. At a new predictor profile, the output reports a fitted value of 118 units, residual standard error \(s=12\) units, leverage \(h_0=0.25\), and a standard error for the fitted mean of 6.0 units. Find the 90% prediction interval.

The residual degrees of freedom are \(df=40-3-1=36\). The reported standard error for the fitted mean is consistent with \(s\sqrt{h_0}=12\sqrt{0.25}=6.0\) units. It does not include the random error of a new outcome, so it is not the prediction standard error.

For a new outcome, include the \(1\) in the variance multiplier:

$$ SE_{\mathrm{pred}} =12\sqrt{1+0.25} =12\sqrt{1.25} \approx13.42\text{ units}. $$

The 90% two-sided critical value for 36 degrees of freedom is approximately 1.688. The margin is \(1.688(13.42)\approx22.65\) units, giving

$$ 118\pm22.65 \quad\Longrightarrow\quad (95.35,\ 140.65)\text{ units}. $$

A suitable report is a 90% prediction interval of about 95.4 to 140.7 units for a new outcome at this predictor profile, under the model assumptions. Using the standard error of the fitted mean instead would give a margin of only \(1.688(6.0)=10.13\) units, which omits new-outcome variation and is not the requested prediction interval.

A Reliable Output-Checking Routine

A few ordered checks reduce the chance of mixing quantities or trusting a label that does not match the numbers. Keep track of units: the fitted value, residual scale, prediction standard error, margin, and endpoints all use the response’s units; leverage and the \(t\) critical value are unitless.

1
Confirm what was requested.
Verify that the software produced an interval for a new outcome, rather than a confidence interval for the mean, and note the stated level and whether it is two-sided.
2
Identify the fit and scale.
Record \(\hat{y}_0\), the residual scale estimate, and any printed standard errors. Check the documented definition of labels such as “RMSE.”
3
Check prediction uncertainty.
Use the printed prediction SE, or calculate \(s\sqrt{1+h_0}\) when the residual standard error and leverage are available. Do not substitute the SE for the fitted mean.
4
Check degrees of freedom and endpoints.
For the standard model, verify \(df=n-k-1\); then compare the endpoints’ midpoint and margin with \(\hat{y}_0\) and \(t^*SE_{\mathrm{pred}}\).
5
Check the level.
Divide the printed margin by \(SE_{\mathrm{pred}}\) and compare the result with the \(t\) critical value for the stated level and residual degrees of freedom. Treat small discrepancies as possible rounding, not proof of exact agreement.

Common Mistake and Why the Check Matters

A common mistake is to see a column labeled “SE,” assume it is the standard error for prediction, and multiply it by a \(t\) critical value. The incorrect reasoning is: “This is the standard error printed beside the fitted value, so it must be the uncertainty for a new response.” The correction is to determine what the software says that SE measures. If it is the SE of the fitted mean, it measures only uncertainty in the estimated mean; a prediction interval for a new outcome must also include the new outcome’s residual variation.

Checking output is useful even when software performs the calculations correctly. It can reveal that the wrong interval type was requested, that a displayed scale uses an unexpected convention, or that degrees of freedom or rounding have been misunderstood. When the procedure is not the usual \(t\)-based method, use the method’s own definition of its interval and level rather than forcing the \(t\)-formula onto it.

Key takeaway: A standard \(t\)-based prediction interval is centered at the fitted value and has margin \(t^*s\sqrt{1+h_0}\), with residual degrees of freedom \(n-k-1\) for the stated regression model. Check the meaning of every software label before substituting its value.

Check Your Understanding

Use the definitions and checks in this tutorial to answer the following.

  1. A software table lists a fitted value, a standard error for the fitted mean, and lower and upper limits. What additional distinction must you check before treating that standard error as the prediction SE?
  2. A regression has 32 observations and four predictors, with an intercept. What residual degrees of freedom are used for the standard \(t\)-based prediction interval?
  3. For a new profile, \(s=5\) response units and \(h_0=0.16\). Calculate the prediction standard error.
  4. A reported interval has midpoint different from the printed fitted value. Name one possible explanation, and state what you would check before deciding the output is inconsistent.
  5. The ratio of a printed interval’s margin to its prediction SE is about 2.1. What further information is needed to check whether this agrees with a stated two-sided prediction level?