1
$\begingroup$

I am using R and am trying to figure out how to merge some forecasts I've done via the vars package, back to my original xts data, which is in levels.

In previous work, I would have used only level data and used rbind to merge the old data with the forecasts, e.g.:

series <- rbind(orig, fcst)

However, the new forecasts I have are in differences, and I'm kind of at a loss as to how to merge the differenced data with the original data in levels. Does anyone have any suggestions?

$\endgroup$

1 Answer 1

2
$\begingroup$

If you have the last observed value $y_t$ and a foreast for the differenced series $\widehat{\Delta y}_{t+1} = \hat y_{t+1} - y_t $, then clearly the forecast of $y_{t+1}$ is $\hat y_{t+1} := y_t + \widehat{\Delta y}_{t+1}$.

Similarly, $\hat y_{t+2} := y_t + \widehat{\Delta y}_{t+1} + \widehat{\Delta y}_{t+2}$ and so on until $\hat y_{t+h} := y_t + \sum_{i=1}^h \widehat{\Delta y}_{t+i}$.

Thus use cumulative sums of the forecasts for the first differences added to the initial value $y_t$ to obtain forecasts for levels of $y_t$.

The R implementation would be apply(rbind(orig,fcst),2,cumsum).

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.