Suppose I have a regression model which yields a couple of predicted values with their respective prediction intervals and the random quantity that I am interested in is the sum of (some subset) of those predicted values. How do I go about building a new prediction interval for this sum? Is it as easy as summing up the limits of the respective prediction intervals?
2 Answers
In short, no, you don't just add the limits. Maybe if the predictions were perfectly correlated, but that's not usually the case at all.
Typically (if the model assumes independence) and you want an interval for a sum of predicted values, you might then think that you can treat the predictions as independent, but they generally aren't independent even when the observations are, because the predictions generally share parameter estimates.
In ordinary regression it's fairly straightforward; you can work out the mean and standard deviation of the sum and construct a t interval similar to the way you would for a single prediction.
If the model is the multiple regression model $y = X \beta + e$ with $e$ ~ $ N(0, \sigma^2 I)$, and you're predicting a vector of future values, $y_f$, where you have a set of predictors for those predictions, $X_f$.
then you want an interval for $a' y_f$ (where in your case, $a$ is a vector of $1$s)
Then $R = a' (y_f - \hat{y}_f)$ ~ $N(0, \sigma^2 m)$
where $m = a' (I + X_f (X'X)^{-1} X_f') a$
so $Q = R/(\sqrt{m}.s)$ is distributed as (standard) Student t with d.f. the d.f. in the estimate of the variance, $\sigma^2$, which for regression is normally $n-p$, where $p$ is the number of predictors including the constant. From the interval for Q, you can then back out an interval for R and then a prediction interval for $a'y_f$.
Assuming I didn't screw up along the way.
-
$\begingroup$ Glen_b: Have you got a reference for the calculation you proposed (book, article, ...) to dive deeper into that matter? $\endgroup$– user7417Commented May 7, 2013 at 12:10
-
$\begingroup$ Sorry, I don't have one that I can think of that does it directly (though doubtless some books do). $\endgroup$– Glen_bCommented May 28, 2013 at 7:38
-
1$\begingroup$ Q & A on Stack Overflow with R implementation: linear model with
lm
: how to get prediction variance of sum of predicted values and Linear regression withlm()
: prediction interval for aggregated predicted values. $\endgroup$ Commented Aug 16, 2018 at 3:36 -
$\begingroup$ In a now-deleted answer Marla suggested this reference for deriving the formula for a summed prediction interval: apps.dtic.mil/dtic/tr/fulltext/u2/678505.pdf $\endgroup$– Glen_bCommented Nov 19, 2019 at 0:12
-
$\begingroup$ Also Thiel, H. 1971. Principles of Econometrics. John Wiley & Sons, New York. $\endgroup$ Commented May 23, 2020 at 2:34
In order to compute the variance of a sum of forecasts you need to incorporate the covariance between these forecasts. Thus compute the varriance and covariance of the observed series for as many lags as the length of your forecast. Compute the sum of these variances and covariances in a standard manner and the use this to talk about uncertainty in the sum of your forecasts. WE use this routinely to take daily predictions and convert them to probabilities of making month-end numbers.
lm
: how to get prediction variance of sum of predicted values and Linear regression withlm()
: prediction interval for aggregated predicted values. $\endgroup$