# Prediction interval, forecast error for a function of a forecast

I have two variables $X$ and $Y$. For each variable I created a forecasting model (using time series) and estimated $X_{t+1}$ and $Y_{t+1}$ and the prediction interval and the error for each.

I have another variable $Z=f(X,Y)$, so $Z_{t+1}=f(X_{t+1},Y_{t+1})$.

How do I calculate the prediction interval and the error for $Z_{t+1}$?

• Are you looking for a confidence interval or a prediction interval? In any case, the answer will depend heavily on $f$. If $f$ is the zero function, the CI/PI will be rather simple to give; if $f(x,y)=x^y$, not so much. Your best bet is likely to simulate from the forecasted distribution of $X$ and $Y$. – Stephan Kolassa Apr 13 '16 at 14:20

Suppose that your predictive density for $X$ is uniform on $[0,1]$, while your predictive density for $Y$ is standard lognormal, and $f(x,y)=x^y$.
Then you can draw (a lot of) random numbers from each predictive density, plug them into $f$ and get a predictive distribution for $Z$, from which you can deduce expected errors (any error measure you want) and prediction intervals. In R:
set.seed(1)

Note that for this to work, you will need to specify the full predictive densities - prediction intervals alone won't help you. That is inherent in the problem. Any prediction interval for (say) $X$ can be consistent with many predictive densities for $X$, and with many different resulting distributions for $Z$.