rforecastingarimafable-r

R libraries forecast::auto.arima vs fable:ARIMA what's the differences?


The online documentation indicates that the algorithm under the hood is the same to estimate the (s)Arima models. During some tests, with a Kaggle dataset, I had different models: ARIMA function show me a sArima, auto.arima only Arima model.

auto.arima(tsbble_item1_store1$sales)

give

Best model: ARIMA(5,1,2)

and

tsbble_item1_store1 %>%
               model(arima = ARIMA(sales))

give

# A mable: 1 x 2
# Key:     store [1]
 store                    arima
<dbl>                  <model>
1     1 <ARIMA(1,1,3)(0,0,2)[7]>

I have very different models. By the way, Arima's fable function shows me a better model, because it controls seasonality respect auto.arima function that doesn't, and the data show evident seasonality.

Does someone know the main differences in default parameters when the two functions try to estimate the model, because I didn't understand from docs?

Sorry if I had some mistakes

thank's in advance

Have nice day

MC


Solution

  • forecast::auto.arima() requires a ts object. That is a vector with some time series attributes including the seasonal frequency. When you just pass a numeric vector, as you have here, it assumes the seasonal frequency is 1 (as for annual data) and will not fit a seasonal ARIMA model.

    On the other hand, the tsibble object contains a time index (in this case it looks like it is a date variable) and ARIMA() will use that index to determine what type of seasonality (if any) is present. With a date variable, it will select seasonal frequency of 7 to correspond to a time of week seasonality.

    To get the same thing with forecast::auto.arima(), use

    auto.arima(ts(tsbble_item1_store1$sales, frequency=7))