Why Reconstruct a Software Interval?
Regression software can report an interval with a few clicks, but the output is only useful if its numbers and label are understood. A confidence interval for the mean response describes uncertainty about the average response at a specified predictor value. A prediction interval describes uncertainty about one future individual response at that value. They use the same fitted value, but they do not use the same standard error.
Reconstructing an interval is a practical audit. It can reveal whether the correct predictor value, residual standard error, degrees of freedom, and interval type were used. It also gives a direct way to assess whether software output is consistent with the regression summaries.
The Model and the Required Summaries
Use the simple linear regression model \(Y_i=\beta_0+\beta_1x_i+\varepsilon_i\), where \(x_i\) is the predictor value and \(Y_i\) is the response for observation \(i\). For the usual exact t intervals, the errors are independent, have mean zero and common variance \(\sigma^2\), and are normally distributed. The mean response is linear in \(x_i\). The interval is conditional on the predictor values; a future individual response is assumed to follow the same model at the chosen predictor value.
In an application, these conditions need to be plausible: the observations should be independent, the relationship should be adequately linear, and residual variation should be reasonably constant and approximately normal for small-sample exact inference. The predictor value should also be within a range supported by the observed data. The calculations below assume these conditions have been checked or are stipulated for the hypothetical examples.
Here \(b_0\) and \(b_1\) are the fitted intercept and slope, and SSE is the sum of squared residuals. Some software labels \(s\) as the residual standard error, residual standard deviation, or root mean square error. Check how the output defines it: the formulas here require the estimate with denominator \(n-2\). If the software supplies \(s_x\) rather than \(S_{xx}\), convert it using \((n-1)s_x^2\), not \(ns_x^2\).
The Two Interval Formulas
For a two-sided interval with confidence level \(1-\alpha\), let \(t^*\) be the positive t critical value with \(n-2\) degrees of freedom that leaves probability \(\alpha/2\) in each tail. Both intervals are centered at the fitted response \(\hat{y}_0\). Their half-widths differ because the uncertainty being described differs.
Individual prediction interval: A prediction interval for one future response at \(x_0\) is \(\hat{y}_0 \pm t^*s\sqrt{1+\frac{1}{n}+\frac{(x_0-\bar{x})^2}{S_{xx}}}\).
The quantity multiplying \(t^*\) is the interval’s standard error. To reconstruct an interval, compute \(S_{xx}\) if needed, substitute into the appropriate standard error, multiply by \(t^*\) to obtain the margin of error, and subtract and add that margin to \(\hat{y}_0\). Keep the response units throughout: if \(s\) is measured in points, both the standard error and margin are in points.
Why the Standard Errors Have These Forms
A short variance argument explains the two formulas. In simple linear regression, the fitted value can be written as \(\hat{y}_0=\bar{Y}+b_1(x_0-\bar{x})\), where \(\bar{Y}\) is the sample mean response. Under the model, \(\operatorname{Var}(\bar{Y})=\sigma^2/n\), \(\operatorname{Var}(b_1)=\sigma^2/S_{xx}\), and \(\bar{Y}\) and \(b_1\) have covariance zero. Therefore,
For a future response \(Y_{\text{new}}\) at \(x_0\), its error around the fitted value includes both uncertainty in the estimated mean and the new individual error. The latter has variance \(\sigma^2\) and is independent of the fitted estimation error. Adding the variances gives
Replacing \(\sigma\) with the residual standard error \(s\) estimates these standard errors. With normal errors, the resulting standardized errors use a t critical value with \(n-2\) degrees of freedom. The extra \(1\) in the prediction formula represents the variation of an individual response around its mean; it is not part of the uncertainty in the mean response.
Reconstructing the Mean-Response Interval
Worked Example: Checking a Mean-Response Interval
Suppose a hypothetical analysis relates staff training hours \(x\) to a clinic’s average satisfaction score \(Y\), measured in points. Assume the model conditions are reasonable, the observations are independent, and 12 training hours is within the observed predictor range. The software summaries are \(n=20\), \(\bar{x}=10\) hours, \(s_x=2\) hours, \(\hat{y}_0=48\) points at \(x_0=12\), and \(s=4\) points. For a 95% interval, use \(t^*=2.101\) with \(df=18\). Reconstruct the confidence interval for the mean satisfaction score at 12 training hours.
First convert the predictor standard deviation to \(S_{xx}\):
The squared distance from \(x_0\) to the predictor mean is \((12-10)^2=4\ \text{hours}^2\). The estimated standard error for the mean response is
Thus the margin of error is \(2.101(1.281)\approx2.692\) points, and the interval is
To two decimal places, the reconstructed interval is approximately 45.31 to 50.69 points. Its interpretation is that the method gives a 95% confidence interval for the population mean satisfaction score among clinics with 12 training hours, under the stated model. It does not describe the likely range of scores for one particular clinic.
Reconstructing an Individual Prediction Interval
Worked Example: Verifying an Individual Prediction
A hypothetical laboratory analysis relates a dose \(x\), in milligrams, to a measured response \(Y\), in units. Suppose the model conditions are reasonable, observations are independent, and \(x_0=8\) mg is within the observed range. Software reports \(n=16\), \(\bar{x}=5\) mg, \(s_x=3\) mg, \(\hat{y}_0=72\) units, and residual standard error \(s=6\) units. Using a 95% critical value \(t^*=2.145\) with \(df=14\), reconstruct the prediction interval for one future response.
The predictor sum of squares is
The predictor-location component is \((8-5)^2/135=9/135=0.066667\). Include the individual-response term of 1:
The margin of error is \(2.145(6.376)\approx13.676\) units. Therefore,
The prediction interval is approximately 58.32 to 85.68 units. Under the model, this interval procedure is designed to cover the response of one future individual measured at a dose of 8 mg in 95% of repeated applications. It is not a 95% interval for the population mean.
For comparison, the mean-response standard error at the same \(x_0\) omits the leading 1:
Its margin is \(2.145(2.156)\approx4.625\) units, giving a confidence interval of approximately 67.37 to 76.63 units for the mean response. This is much narrower because estimating an average does not include the full variation among individual responses.
Auditing Both Intervals in Software Output
Worked Example: Checking Rounded Software Endpoints
Consider a hypothetical model for a response measured in points. Assume independent observations, reasonable linear and constant-variance conditions, approximately normal errors, and that the predictor mean is within the observed range. The summaries are \(n=25\), \(\bar{x}=40\), \(s_x=5\), \(\hat{y}_0=18.2\) points at \(x_0=40\), and \(s=2.4\) points. For 95% intervals, \(t^*=2.069\) with \(df=23\). Suppose software displays a mean-response interval of 17.21 to 19.19 and a prediction interval of 13.1 to 23.3. Verify both.
First, \(S_{xx}=(25-1)(5^2)=600\). Because \(x_0=\bar{x}\), the location term is zero. The mean-response standard error and margin are
The interval is \(18.2\pm0.99312=(17.20688,\ 19.19312)\) points, which rounds to 17.21 to 19.19. This agrees with the displayed mean-response interval.
For an individual prediction, retain the extra 1:
The prediction interval is approximately \(18.2\pm5.064=(13.136,\ 23.264)\) points, or 13.1 to 23.3 to one decimal place. That agrees with the software display at its stated precision. Small differences in the final digit can occur when software uses more precise internal values than the rounded summaries shown in its output.
A Reliable Verification Process
Decide whether the output concerns a population mean response or one future individual response. The label determines whether the standard error includes the leading 1.
If only the predictor sample standard deviation is given, calculate \(S_{xx}=(n-1)s_x^2\). Record units carefully; the squared units cancel in the ratio involving \((x_0-\bar{x})^2\).
For a two-sided \(1-\alpha\) interval, use the t critical value for \(df=n-2\), not a normal critical value or the degrees of freedom from another model.
Calculate the applicable standard error, multiply by \(t^*\), and add and subtract the margin from \(\hat{y}_0\). Compare endpoints at the same rounding precision as the software.
If the endpoints disagree substantially, check the interval label first, then confirm the predictor value, residual standard error, sample size, \(s_x\), confidence level, and degrees of freedom. If the discrepancy is only in the last displayed digit, rounding of the reported summaries may explain it.
Common Mistake
A frequent error is to use the mean-response formula for an individual prediction because both intervals are centered at the same fitted value. For example, using \(s\sqrt{1/n+(x_0-\bar{x})^2/S_{xx}}\) for a future individual omits the individual-response variation. The resulting interval is too narrow and answers a different question: uncertainty about a mean, not uncertainty about one response. Conversely, adding the leading 1 when the target is a mean response makes that interval unnecessarily wide and mislabels the target.
Check Your Understanding
Use the formulas and verification steps above to answer these questions.
- A regression has \(n=18\) and predictor sample standard deviation \(s_x=4\). What is \(S_{xx}\)?
- Which interval formula includes the leading 1, and what source of uncertainty does it represent?
- For a two-sided 95% interval from a simple linear regression with \(n=30\), what degrees of freedom determine the t critical value?
- At \(x_0=\bar{x}\), how does the mean-response standard error simplify? How does the prediction standard error simplify?
- Software’s reported prediction interval is much narrower than the reconstructed mean-response interval. Name two quantities or choices you would check first.