I am trying to estimate ARIMA models for 100 different series. So I employed fabletools::model()
method and fable::ARIMA()
function to do that job. But I couldn't able to use my exogenous variables in model estimation.
My series has 3 different columns, first ID tag identifying the first outlet, then Date.Time tag, and finally the Sales. In addition to these variables I also have dummy variables representing hour of day and week of day.
Following the code given bellow I transformed the dataframe which contains my endegounus and exegenous variables to tstibble.
ts_forecast <- df11 %>% select(-Date) %>%
mutate(ID = factor(ID)) %>% group_by(ID) %>% as_tsibble(index=Date.Time,key=ID)%>%tsibble::fill_gaps(Sales=0) %>%
fabletools::model(Arima = ARIMA(Sales,stepwise = TRUE,xreg=df12))
With this code I try to forecast values for same date.time interval for multiple outlets indentified with ID factor. But, The code returns the following error.
> Could not find an appropriate ARIMA model.
> This is likely because automatic selection does not select models with characteristic roots that may be numerically unstable.
> For more details, refer to https://otexts.com/fpp3/arima-r.html#plotting-the-characteristic-roots
Sales are my endogenous target var and df12 includes dummy variables representing hour and day. Some of the stores don't create sales in some specific hours so their dummy representing 01:00 AM could be equal to zero for all observation. However I don't think that would be a problem while fable uses stepwise method. I suppose, when the code sees variable with 0s it can exclude them
I am not sure what is the problem. Am I using problematic way to add xreg to the model (in ARIMA hep page it says xreg= like previous forecast package is OK) or issue is related with the second problem i mentioned dummies including "0" for all observation. If it is the second one there could be solution that can exclude all variables with constant 0 value.
I would be delighted if you can help me.
Thanks
Here is an example using hourly pedestrian count data.
Created on 2020-10-09 by the reprex package (v0.3.0)
Notes:
season("day")
special withinARIMA
will generate the appropriate seasonal categorical variable, equivalent to 23 hourly dummy variables.pdq
special to automatically select the optimal model.PDQ(0,0,0)
special as you don't need the ARIMA model to handle the seasonality when you are doing that with the exogenous variables.