Un-difference the forecasted values?

Viewed 3139

I'm forecasting 12 periods of closing stock prices (h=12) using differenced data diff(), and here is the forecast that I obtain (in differenced values):

2.888385
1.1857476
-21.3611575
-0.7809216
-0.5733661
19.5797974
-20.8540668
19.5703453
-20.8459073
-0.63805
-0.6380927

How would you go back to find the corresponding "un-differenced" closing stock prices? Knowing that the value of my last observed stock price (at h=0) was 152.00? I'm trying to use diffinv() but can't seem to obtain what I am looking for.

Thank you!

1 Answers

If your forecasts are in x and original value in h0, you could do h0 + cumsum(x)

Related