Search code examples
rtime-seriesarimaforecast

Time Series Analysis with Arima


I am encountering an error when trying to apply the auto.arima function that I do not understand.

Creation of time series data:

tsData = ts(TimeSeries_Data$`1`, frequency = 12, start = c(2019,1))

Time series data:

> print(tsData)
      Jan  Feb  Mar  Apr  May  Jun  Jul  Aug  Sep  Oct  Nov  Dec
2019  773 2965 1875 2286 2387 3260 3234 2378 2930 5115 3992 2693
2020 3134 6406 2789 2097 1716 4990 1979 2915 3032 7220 6992 565

Modeling:

model_1 <- auto.arima(tsData, stepwise = FALSE, trace = TRUE)

Error message:

Warning message:
The chosen seasonal unit root test encountered an error when testing for the first difference.
From stl(): series is not periodic or has less than two periods
0 seasonal differences will be used. Consider using a different unit root test. 

I do not understand why my times series data is not periodic or has less than two periods, because the printed data looks fine to me.

Could somebody please point me into the dirction of my mistake and a possible solution?

Please let me know, if I have any information missing required to answer my questions.

Thank you!


Solution

  • It's not an error, it is only a warning. Depending on the seasonal unit root test you are using it can be (as with stl) that you need more than 24 observations for monthly data (depending on the number of parameters which have to be estimated). You either have to get 25 observations or you could try, for example:

    auto.arima(tsData, stepwise = FALSE, trace = TRUE, seasonal.test = "ocsb")