# Prediction for differenced Time Series model

I am working on a Time Series model, and the series appeared to be non stationary (presence of trend & seasonality), as I was using ARIMA to predict for my time Series , I performed first order differencing.

My question is now if I am predicting future values, are the predictions going to be differenced? Do I need to undo the differencing in any manner before forecasting?

On a side note, can I use an ARIMA (p,d,q) (P,D,Q) model instead of differencing to account for seasonality ?

• The answer is yes, the predictions will be transformed and, if you try to do this manually, you will need to back-transform your model to get the correct forecasted values. The good news is that this process is fully automated in most statistical software so you won't have to do it manually. Jul 24, 2017 at 10:51
• @Digio , any suggestions on how to tackle it in R, or just the forecast function will take care of it in R, also any comments on the SARIMA vs ARIMA with differencing part in my question ? Jul 24, 2017 at 10:55
• I have reposted everything as an answer below. Jul 24, 2017 at 11:05
• I want to bump this question. I am not using any automated package and I have differenced my time series and now my model is predicting difference forecasts. If I have to un-difference it then what would be the solution? Would I have to forecast for all of the data I have (train + test), then concatenate forecasts for both train & test and then un-difference using cumulative sum and the 1st known value in the train dataset? Please let me know ASAP! Apr 9, 2021 at 10:57

The answer is yes, the predictions will be transformed and, if you try to do this manually, you will need to back-transform your model to get the correct forecasted values. The good news is that this process is fully automated in most statistical software so you won't have to do it manually. An example using Hyndman's 'forecast' package would be:

# Without integrated term:
plot( forecast(Arima(y = WWWusage, order = c(1,0,1))) )

# With integrated term:
plot( forecast(Arima(y = WWWusage, order = c(1,1,1))) )


As you can see, in both cases the output forecast value in the back-transformed units, as opposed to:

# With manual differencing (non-automated way):
plot( forecast(Arima(y = diff(WWWusage), order = c(1,0,1))) )


which forecasts unintelligible values.

If you want to use a seasonal ARIMA(p,d,q)(P,D,Q) model you should do so on grounds of some model validation metric and not because you're trying to sidestep the integrated terms (which you probably won't anyway). The best thing to do would be to let function auto.arima select a model for you.

• thanks for the answer, I was wondering if we perform differencing it will remove or try to remove seasonality , then how can we use ARIMA(p,d,q)(P,D,Q) ? i.e can we use differencing along with seasonality ? Jul 24, 2017 at 12:18
• You must see differencing and seasonality as two different things. The integrated term removes trend, not seasonality. A seasonal model will likely require an integrated term as much as a non-seasonal. Jul 24, 2017 at 12:27
• ohh, that explains, but from [link] [otexts.org/fpp/8/1], it states "Transformations such as logarithms can help to stabilize the variance of a time series. Differencing can help stabilize the mean of a time series by removing changes in the level of a time series, and so eliminating trend and seasonality." It seems to be a reputed site and thats why I am confused. Jul 24, 2017 at 12:32
• Yes, it's a book written by the person I cited earlier (Pr. Hyndman) but I think you misinterpreted what it says. Stationarity transformations such as logarithmising may create a "seasonally adjusted time series" (where seasonality exists) but the purpose of the differencing operator is to remove trend and can be applied just as well to non-seasonal series. It is nowhere implied that a seasonal model will never have to be differenced, e.g. auto.arima(JohnsonJohnson) returns an ARIMA(1,1,2)(0,1,0) model. Jul 24, 2017 at 13:06
• Ohh that explains it, is it possible that if we have time series which has only seasonality and no trend then we can directly apply a seasonality Arima in forecast instead of differencing Jul 24, 2017 at 14:51