4

Im new to time series forecasting, and I was trying to model the folowing time series data using ARIMA model in R, so that I can predict for the future 10 time periods.

data: cereal_dataset

enter image description here

When I try to decompose the time series using stl() I get the following error.

   Error in stl(cereal_ts, s.window = "per", robust = TRUE) : series is not periodic or has less than two periods

Also the ACF and PACF plots didn't return anything promosing.

# plot acf 
acf(cereal_ts)
# plot pacf 
pacf(cereal_ts)

enter image description here

Next I tried to fit a model using auto.arima() in R which returned ARIMA(0,0,0).

model <- auto.arima(cereal_ts)
summary(model)

Series: cereal_ts ARIMA(0,0,0) with non-zero mean

Coefficients: mean 178.5572 s.e. 2.5958

From the graph, it looks like something that can be modelled. Or am I looking at a dead end. Im new to time series forecasting, so please suggest any alternative or better way of doing it.

  • 1
    The link to the data set requires a password/permission. The data looks small enough that you can just run dput(cereal_ts) in R and paste the output into your question. – AkselA Dec 30 '23 at 18:27
  • @AkselA you are not able to download it either? – Dominic Joseph Jan 02 '24 at 19:20

1 Answers1

6

stl() returns an error because your time series is not a priori periodic. In monthly or quarterly data, we expect possible yearly seasonality, i.e., recurring patterns with fixed cycle length (12 or 4, respectively). For these, we would set a frequency attribute for the time series object. There are very few yearly series where we would expect such a fixed cycle length (sunspots being one example).

From the graph, it looks like something that can be modelled.

Be very careful with this kind of intuition, especially in time series. In this field, it is extremely easy to spot "patterns" that simply do not exist, and are not useful for forecasting.

auto.arima() detects a model that is simply the long-run average, with no autoregressive or moving average dynamics that can be leveraged for forecasting. Looking at your time series and your ACF plot (I trust auto.arima() more than ACF/PACFs, Selecting ARIMA orders by ACF/PACF vs. by information criteria), that looks exactly right. I would absolutely trust this. auto.arima() is in my opinion the gold standard in automatic ARIMA modeling and forecasting. Yes, your forecast will be a flat line. And this is very probably the best you can do, as disappointing as this may be.

Here is a fun little exercise: simulate 19 time series off the fitted model, and with the same length as your series (arima.sim()). Randomly arrange these and your series in a $4\times 5$ grid. Does your focal series stand out in any way? Chances are it doesn't. (Also, show the grid to your friends and ask them whether one series stands out. Can they identify yours?) That is because its pattern is absolutely consistent with an ARIMA(0,0,0) process. See Source for inter-ocular trauma test for significance.

Some threads that may be useful:

Stephan Kolassa
  • 123,354