I am building different forecasting models on my time series (which is not stationary). Some models require stationarity, others don't. My goal is to test a few models on a training set, compare the forecasts to the observed values (the test set), and see which model was the most accurate in forecasting.

However, as I am differencing my data for some models only, when I'm trying to compare the forecasts I obviously end up with different type of output (differenced vs. undifferenced). How should do we usually proceed at this point? Is there a way to revert back my forecasts to "undifferenced" data (in R)?

In know that with ARIMA, it's easy as I can simply ask ARIMA to difference it for me. But when I difference manually using diff()before forecasting using ETS(), then it's a different story. I only difference once by the way.

Thank you!

  • $\begingroup$ .................................... $\endgroup$ – IrishStat Nov 22 '17 at 21:00

You should compare your models on identical tasks. If your goal is to forecast levels, then each model must produce a forecast of the level to compare with the others. If one of your models naturally produces a forecast of some transformation of the data, you have to invert it to do this comparison.

If the transformation is differencing, the opposite transformation is the cumulative sum. You can see this by the telescoping sum:

$$\sum_{i=1}^t (X_i - X_{i-1}) = X_t - X_{t-1} + X_{t-1} - \ldots - X_1 + X_1 - X_0 = X_t - X_0$$

So then

$$ X_t = X_0 + \sum_{i=1}^t \Delta X_i$$

Similarly, the level forecast for $t+h$ made at $t$ is:

$$ \hat{X}_{t+h} = X_t + \sum_{i=1}^h \Delta \hat{X}_{t+i}$$

In R, you can do this with the function diffinv. You have to pass in the very last point of the data as the argument xi.


If you are going to conduct that test of evaluating forecast form 1 and only 1origin , I would SERIOUSLY suggest that you evaluate accuracies from multiple origins where the model developed for the history may change as you have add new observation to the history. One origin for each series is always just 1 sample.

Differencing is just 1 part of a model which could contain ARMA structure . level shifts , time trends , seasonal pulses while incorporating remedies for non-constant parameters and remedies for non-constant error variance.

Select your tools of choice and compare the ensemble accuracy from a number of origins for each tool. Your tools should always include a provision for detecting anomalies and provision for delivering ROBUST estimates of the model form/parameters including testing the assumptions of the model form. If the tool doesn't do that then discharge that tool.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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