Tutorials › Regression Analysis (Undergraduate) › Prediction Intervals for Hospital Length of Stay

Integrated Applied Case Studies · Tutorial 972 of 991

Prediction Intervals for Hospital Length of Stay

Work through hospital length-of-stay predictions, comparing uncertainty for an individual patient with uncertainty in a profile’s estimated mean.

Advanced 10 min read

What You'll Learn

  • Calculate a prediction interval for an individual hospital stay from a fitted regression model.
  • Distinguish an individual prediction interval from a confidence interval for the mean stay at a profile.
  • Interpret the leverage term and explain its effect on interval width.
  • Check the model conditions needed for the usual interval formula.
  • Explain why a negative lower endpoint does not imply that a patient can have a negative stay.

Why Prediction Needs an Interval

A hospital may want to predict how long a patient with a particular admission profile will stay. A fitted regression model provides a predicted length of stay, but this is not a promise about the individual patient. Patients with the same recorded predictors can still have different stays. The interval for an individual prediction must account for that patient-to-patient variation as well as uncertainty in the estimated regression mean.

This distinction is central to communicating a prediction. An interval for the mean stay of patients with a specified profile answers a different question, and is generally narrower. The width of either interval can also vary across profiles: the model is less certain about its mean response at predictor values that are less well represented by the data.

Model and Conditions

Suppose the response \(Y\) is hospital length of stay, measured in days, and a multiple linear regression model uses \(k\) predictors. For patient \(i\), write the model as \(Y_i=\beta_0+\beta_1x_{i1}+\cdots+\beta_kx_{ik}+\varepsilon_i\). Here the predictors describe the patient, the \(\beta\)'s are unknown regression coefficients, and \(\varepsilon_i\) is the error.

Model conditions for the usual prediction interval: The conditional mean of length of stay is correctly represented by the specified linear regression model; errors have mean zero and a common variance \(\sigma^2\); observations are independent; and, for the usual exact \(t\)-based interval in a small or moderate sample, errors are normally distributed. The patient profile being predicted must be measured on the same scale and have the same meaning as in model fitting. Predictions far beyond the observed predictor values require particular caution.

In a fitted model, \(\hat{Y}_0\) denotes the estimated mean length of stay for a specified predictor profile \(x_0\). Let \(s\) be the residual standard deviation, \(n\) the sample size, and \(p=k+1\) the number of fitted coefficients including the intercept. The residual degrees of freedom are \(df=n-p\). The profile's leverage is \(h_0=x_0^\mathsf{T}(X^\mathsf{T}X)^{-1}x_0\), where the profile vector includes the intercept term and \(X\) is the model's design matrix.

Leverage describes how far the profile lies from the center of the predictor patterns used to fit the model, accounting for the predictors' scales and relationships. A larger \(h_0\) means greater uncertainty in the estimated mean at that profile. It does not, by itself, measure how variable individual stays are.

The Prediction Interval Formula

For a new patient's stay \(Y_{\mathrm{new}}\) with profile \(x_0\), a two-sided \(100(1-\alpha)\%\) prediction interval under the stated model conditions is

$$ \hat{Y}_0 \ \pm\ t^*_{df}\,s\sqrt{1+h_0}. $$

Here \(t^*_{df}\) is the positive \(t\)-critical value with \(df\) degrees of freedom that leaves probability \(\alpha/2\) in each tail. The factor \(s\sqrt{1+h_0}\) is the standard error for predicting one new outcome. The \(1\) inside the square root accounts for the new patient's own outcome variation; \(h_0\) accounts for uncertainty in estimating the mean at that patient's profile.

By comparison, a confidence interval for the mean length of stay among patients with profile \(x_0\) is

$$ \hat{Y}_0 \ \pm\ t^*_{df}\,s\sqrt{h_0}. $$

Both intervals use the same fitted mean and critical value, but the individual prediction interval includes the additional \(1\). Since \(1+h_0>h_0\), it is wider when the same \(s\) and critical value are used. This is not a cosmetic difference: the confidence interval describes uncertainty about an average, while the prediction interval describes uncertainty about one patient's outcome.

Worked Example: Predicting an Individual Patient's Stay

Consider a hypothetical model fitted to 100 patients, using age and an admission severity score as predictors. Its fitted equation, with age measured in years and the severity score on a 1-to-10 scale, is \(\hat{Y}=-0.280+0.078(\text{age})+0.640(\text{severity})\), with length of stay in days. Suppose the residual standard deviation is \(s=2.10\) days. For a 50-year-old patient with severity score 2, the model output gives \(\hat{Y}_0=4.900\) days and \(h_0=0.040\). Find a 95% prediction interval. Assume the model conditions are reasonable for this illustration.

The model has three fitted coefficients: an intercept and two slopes. Thus \(df=100-3=97\). The 95% critical value is \(t^*_{97}=1.985\). The standard error for an individual prediction is

$$ SE_{\mathrm{pred}}=2.10\sqrt{1+0.040} =2.10\sqrt{1.040} \approx 2.141588\text{ days}. $$

The margin of error, retaining precision through the calculation, is

$$ 1.985(2.10)\sqrt{1.040} \approx 4.2510526\text{ days} \approx 4.251\text{ days}. $$

Therefore the interval is \(4.900\pm4.2510526\), or approximately \((0.649,\ 9.151)\) days after rounding each endpoint to three decimal places. Under the model, this procedure produces intervals that cover the stay of a new patient with this profile in 95% of repeated samples. It does not mean there is a 95% probability that this particular patient's fixed, as-yet-unobserved stay lies in the calculated interval.

Why the Interval Has These Two Sources of Uncertainty

A short derivation explains the additional \(1\) in the prediction standard error. If the true mean at profile \(x_0\) is \(\mu_0=x_0^\mathsf{T}\beta\), the new patient's outcome can be written \(Y_{\mathrm{new}}=\mu_0+\varepsilon_{\mathrm{new}}\). The prediction error is therefore

$$ Y_{\mathrm{new}}-\hat{Y}_0 =(\mu_0-\hat{Y}_0)+\varepsilon_{\mathrm{new}}. $$

Under the regression model, the new error is independent of the fitted coefficients and has variance \(\sigma^2\). The estimated mean at the profile has variance \(\sigma^2h_0\). Independence means the variances of these two terms add:

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

Replacing \(\sigma\) with the residual standard deviation \(s\), and using the \(t\) critical value with residual degrees of freedom, gives the stated prediction interval. For the estimated mean alone there is no new patient's error term, so its variance is \(\sigma^2h_0\), which gives the confidence interval formula instead.

Comparing Patient Profiles

The fitted mean can change from one profile to another, and so can leverage. The following hypothetical model summaries use the same \(s=2.10\) days, \(df=97\), and \(t^*_{97}=1.985\). The profile outputs are assumed to come from the fitted model. Each interval is calculated for an individual stay, not for a group mean.

Worked Example: How Profile Leverage Changes Interval Width

Compare a 50-year-old patient with severity score 2, a 65-year-old patient with severity score 9, and a 30-year-old patient with severity score 1. Suppose their fitted means and leverages are respectively \((4.900,\ 0.040)\), \((10.550,\ 0.250)\), and \((2.700,\ 0.160)\), where the first number is in days.

For the first profile, the margin is \(1.985(2.10)\sqrt{1.040}=4.2510526\), approximately 4.251 days. Its interval is approximately \((4.900-4.2510526,\ 4.900+4.2510526)=(0.649,\ 9.151)\) days.

For the second profile, with the largest leverage, the prediction standard error and margin are

$$ 2.10\sqrt{1+0.250}=2.10\sqrt{1.250} \approx2.3478714\text{ days}, $$

$$ 1.985(2.10)\sqrt{1.250}\approx4.6605247\text{ days}\approx4.661\text{ days}. $$ Thus its interval is approximately \((10.550-4.6605247,\ 10.550+4.6605247)=(5.889,\ 15.211)\) days.

For the third profile, the margin is

$$ 1.985(2.10)\sqrt{1+0.160} =1.985(2.10)\sqrt{1.160} \approx4.4896119\text{ days} \approx4.490\text{ days}. $$

Its nominal interval is approximately \((2.700-4.4896119,\ 2.700+4.4896119)=(-1.790,\ 7.190)\) days. These widths differ because the profiles have different leverages, even though the model's residual standard deviation and critical value are held fixed. The profile with leverage 0.250 has the widest interval.

Mean Intervals Are Not Individual Prediction Intervals

For the first profile in the comparison, the 95% confidence interval for the mean stay uses \(s\sqrt{h_0}\), not \(s\sqrt{1+h_0}\). Its standard error is \(2.10\sqrt{0.040}=0.420\) days, and its margin is \(1.985(0.420)=0.8337\) days. The confidence interval is \(4.900\pm0.8337\), or approximately \((4.066,\ 5.734)\) days.

This interval estimates the average stay for patients represented by that profile under the model. It does not describe the likely range of stays for individual patients. The individual prediction interval, \((0.649,\ 9.151)\) days, is much wider because individual outcomes vary around their profile mean.

For the second profile, the mean interval's standard error is \(2.10\sqrt{0.250}=1.05\) days. Its margin is \(1.985(1.05)=2.08425\) days, giving a 95% confidence interval of approximately \((8.466,\ 12.634)\) days for the mean. The individual prediction interval, approximately \((5.889,\ 15.211)\) days, is wider for the same reason: it includes the new patient's outcome variation.

Interpreting Width and Checking the Model

A prediction interval is useful when a decision concerns one patient: for example, planning a bed or discussing a plausible range of stay durations. A point prediction alone hides uncertainty. A wider interval may be practically important, even when the fitted mean is precise enough for a different purpose.

Before interpreting an interval, check whether the model is suitable for the prediction task. The predictor values should be within or reasonably close to ranges represented in the fitting data. The relationship between predictors and mean stay should be adequately modeled; errors should not show substantial changes in spread or dependence; and influential observations or data limitations may affect the fitted model. The diagnostics and validation evidence inform whether the formula's nominal coverage is credible in the intended setting.

The third profile's lower endpoint is negative, even though length of stay cannot be negative. This does not mean the model predicts a negative stay as its fitted mean: its fitted mean is 2.700 days. Rather, the linear model's symmetric interval extends below the physical boundary. Do not silently replace the lower endpoint with zero and continue calling the result a standard 95% prediction interval; truncation changes its coverage properties. A negative bound flags a possible limitation of the model or of the normal, constant-variance approximation, and should be reported and investigated in context.

Key takeaway: Use \(s\sqrt{1+h_0}\) for a new individual outcome and \(s\sqrt{h_0}\) for the estimated mean at a profile. Higher leverage widens both intervals, while individual outcome variation makes the prediction interval wider than the mean confidence interval.

Common Mistakes

  • Using the mean confidence interval for an individual. The formula with \(s\sqrt{h_0}\) omits the new patient's outcome variation. For an individual stay, use \(s\sqrt{1+h_0}\).
  • Interpreting a 95% interval as a 95% probability for this fixed outcome. The 95% describes the long-run coverage of the interval procedure under the model conditions, not a probability assigned to a particular fixed stay after the interval is calculated.
  • Assuming every profile has the same width. Since the formula contains \(h_0\), leverage can make intervals wider for some predictor profiles than others.
  • Ignoring an implausible endpoint. A negative lower endpoint is not a valid possible length of stay. It signals that the model-based interval has crossed a physical boundary, and should prompt careful interpretation rather than unreported clipping.
  • Rounding intermediate quantities too early. Keep the standard error and margin at full available precision while calculating endpoints, then round the final results consistently.

Check Your Understanding

Use the model and conventions in this tutorial to answer the following questions.

  1. In words, what does a 95% prediction interval for one patient's stay describe, and what does it not describe?
  2. Why does the prediction standard error contain \(1+h_0\), while the standard error for a confidence interval for the mean contains only \(h_0\)?
  3. For \(s=2.10\) days and \(h_0=0.090\), write the standard error formula for a new individual prediction. Would it be wider or narrower than the interval at \(h_0=0.040\), all else equal?
  4. Why might a prediction interval extend below zero, and why is simply replacing its lower endpoint with zero not automatically justified?
  5. A report gives a narrow confidence interval for the mean stay at a patient profile. What additional source of uncertainty must be included before using an interval to describe an individual patient's stay?