Solved – add the seasonal effect and trend back to ARIMA forecast

arimarseasonalitytime seriestrend

I'm a newbie in Time Series Analyses. I'm using ARIMA to make a prediction about my monthly data. So sorry that I cannot post my data here, you can just dump the data to use for example.

I use auto.arima() to build my model and forecast to predict. Both functions are loaded from forecast library. From my understanding, before building the model, we have to remove the trend and seasonal effect from our data, right? So, my question is: do we have to add them back to the predicted value? If we do, then how? Or the predicted values are already counted for trend and season?

Could you please show me an example with plots about this? Thank you so much for your help.

EDIT

I'm adding some plots to this post.

My Data

Here is how my data look like

Deomposition

Then, I decompose it. From this graph, I can see that it has a seasonal effect, no trend, and large remainder. Is it bad, the remainder?

Then, I remove the seasonal effect using seasadj() function, put the adjusted data into the auto.arima(), and make prediction. Then, here is what I got:

Prediction with adjusted data

After reading your answer, I try putting my original data to the auto.arima(), and I got this prediction:

Prediction with original data

So, is everything good? Did I do anything wrong? And I think I should take the second prediction so that I don't have to put the seasonal effect back in? Am I right?

Best Answer

  1. No, you do not need to remove trend and/or seasonality before fitting an ARIMA model.

    These models can handle certain types of trends and certain types of seasonality by themselves, or by including external regressors (the xreg argument, where you could include more complicated related effects like moving holidays, or non-polynomial trends, breaks in the trend, etc).

    Including these regressors is intuitively similar to "removing trend and seasonality first, then ARIMA" (regression-with-ARIMA-errors model), but is done efficiently in one fitting step.

  2. Yes, if you have removed trend and seasonality before fitting an ARIMA model, you will need to "add them back in" to get a forecast of your original series; that is, you need a forecast of the trend and seasonality to add back to your forecast of the rest. In some cases, the "forecast" of the seasonality is known exactly (e.g. the future dates of a moving holiday), which makes it easier.

    If you have removed trend or seasonality by some process which does not define dynamics for these components (e.g. the X11 procedure for seasonality adjustment), then there is no canonical way to do this; you would need to estimate a new model to forecast these components.

Edit: Here's a simple R example for a classic series (AirPassengers) which has both trend and seasonality of a kind which can be reasonably well-captured by a standard (seasonal) ARIMA model, without additional regressors:

library(forecast)

mod <- auto.arima(AirPassengers)
fc <- forecast(mod, h=12)

plot(fc)

forecast

Related Question