I'm trying to forecast a daily time series while taking into consideration the effect of weekends and holidays using different methods in R.
For arima()
it was simply done by adding a dummy variable in the xreg
argument.
But for other methods such as : ets()
tbats()
stlm()
theta()
etc… I couldn't find how to accomplish the same thing.
Any through, guidance or advice will be greatly appreciated.
Best Answer
ets() can't take external regressors. See here for a discussion.
tbats() should be able t model weekends without using dummy variables. If your holidays are regular, it might be able to capture them without dummy variables.
stlm() isn't really suitable for your task. I don't know about theta().
ets() can capture only one seasonality, so it will capture weekends if a 7 day periodicity is the only seasonality present in the data, otherwise it will not work too well.
If you have your heart set on using ets() then you should filter out the holidays first. The software I work with for retail demand forecasting uses exponential smoothing models (similar to ets()) and the way we deal with moving holidays is we remove them from the data first, then apply the forecasting algorithm, the bring back the holiday effect into the final forecast.
However, you are probably better off using a more suitable method. BSTS fits a state space model similar to ets() but can handle multiple seasonalities (by using a trigonometric seasonal component similar to TBATS) and can also take into account holidays. Facebook Prophet can handle multiple seasonalities and moving holidays as well, although it doesn't use state space methods like BSTS or ets().