I have a basic question with the auto.arima function in the "forecast" package in R. I create a model using the following simple commands:

data_ts<-ts(data$Value, frequency=24)
plot(forecast(fc, level=c(80), h=30*24)) 

The result looks always like this

enter image description here

After some periods it converges to the mean value. Is this a "normal" behaviour with ARIMA models or is it a sign that some information or parameter is missing?

BTW: On weekends I have different patterns. Is this considered automatically by auto.arima or do I have to create a dummy variable and use xreg?


up vote 6 down vote accepted

In your ARIMA specification, the middle number in both the first and the second bracket is zero. That means, there is no [simple] differencing and no seasonal differencing. Thus your series appears to be mean-stationary (rather than integrated or seasonally integrated). (As far as I know, the AR and MA parameters yielded by the auto.arima function are restricted to be in the region of stationarity; meanwhile, nonstationarity can be introduced by [simple] or seasonal differencing.) Given a mean-stationary process, you should actually expect the point forecasts to converge to the mean of the process. That is one of the intrinsic features of a mean-stationary time series. And that is also why these kind of processes are called "mean-reverting".

Regarding weekends, you have only supplied the frequency as frequency=24, and auto.arima will not guess whether there is weekly, monthly or other kind of seasonality besides what you have specified. You could indeed create some dummies and supply them using xreg to account for the day-of-the-week pattern.

  • BTW: I added D=1 (read that somehwhere here), so it doesn't converge anymore, which is good for my purpose, but honestly I am not sure about the effect or the meaning. Weekends are not considered so far, I will try the xreg parameter and a dummy variable. – MikeHuber Sep 21 '15 at 19:51
  • Although you do not expect the process to behave the way it looks in the graph, the forecast might still be the best in some reasonable sense. E.g. the forecast might have the smallest mean squared error (MSE) in some class of models. By forcing D=1 you might make the picture look less suspicious but you might actually increase the forecast error. This perhaps deserves a more detailed explanation but I do not have the time tonight, sorry. – Richard Hardy Sep 21 '15 at 20:10

As a complement to the first part of the answer given by @RichardHardy, it could be checked analytically that the forecasts converge to a constant as the forecasting horizon goes to infinity.

For simplicity, let's take an ARMA(1,1) model defined as follows:

$$ y_t = \delta + \phi y_{t-1} + \epsilon_t + \theta \epsilon_{t-1} \,, \quad \epsilon_t \sim NID(0, \sigma^2) \,, \quad t=1,2,\dots,T \,. $$

The expected value of the ARMA(1,1) process, denote by $\mu$, is given by:

\begin{eqnarray} \begin{array}{rcl} E(y_t) &=& \delta + \phi E(y_{t-1}) + E(\epsilon_t) + \theta E(\epsilon_{t-1}) \,, \\ \mu &=& \delta + \phi \mu + 0 + 0 \,, \\ \mu &=& \frac{\delta}{1 - \phi} \,. \end{array} \end{eqnarray}

We used the fact that, assuming the fitted model is restricted to be a stationary process, then the mean of the process is the same at different time periods and, hence, $E(y_t) = E(y_{t-1})) = \mu$; $E(\epsilon_t) = E(\epsilon_{t-1}=0)$ by definition.

The forecast function of the ARMA(1,1) process is given by:

\begin{eqnarray} \begin{array}{rcl} E(y_{T+1}) &=& \delta + \phi E(y_{T}) + \theta \epsilon_{T}) \,, \\ E(y_{T+2}) &=& \delta + \phi E(y_{T+1}) + \theta \epsilon_{T}) = (1+\phi)\delta + \phi^2y_T + \phi\theta\epsilon_T\,, \\ \dots \\ E(y_{T+k}) &=& (1 + \phi + \phi^2 + \cdots + \phi^{k-1} + \phi^k y_{T} \phi^{k-1}\theta\epsilon_{T}) \,, \\ \end{array} \end{eqnarray}

taking $k\to\infty$:

$$ \lim_{k\to\infty} = E_T (y_{T+k}) = \frac{\delta}{1 - \phi} \,, $$

which is equal to the expected value of the process that we obtained before.

Notice that, since the process is stationary, $|\phi| < 1$ and hence the term $\phi^k$ is dropped; this condition implies also that the summation converges to $1/(1+\phi$).

The same idea could be applied to the ARIMA(2,0,1)(2,0,0) model that you show, but the operations would be much more cumbersome. The model would be:

$$ (1 - \phi_1L - \phi_2 L^2)(1 - \Phi_1L^{24} - \Phi_2L^{48})y_t = \delta + \epsilon_t + \theta\epsilon_{t-1} \,, $$

where $L$ is the lag operator such that $L^iy_t = y_{t-i}$. Before applying the idea shown above, the product of polynomials should be first expanded as it is done here. The resulting expression is a bit cumbersome, so just for illustration purposes we can stick to the example of the stationary ARMA(1,1) process.

It seems that you are pursuing 30 days ahead forecasts. This is probably beyond the abilities of these models. They are intended for short-term forecasting (partly due to the issues discussed here). See for example the discussion in this post.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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