I am trying to forecast the sales for next 48 days from the data given by modelling for multiple seasonality and day of week , promotional effects. R could not come up with a suitable model. I need help to figure out what I am doing wrong.
Given data has daily sales information of a store for 2 years and 7 months along with other information like holidays, promotion, week of year etc as shown below. Sales is 0 when store is closed. I have replaced 0 sales with NA's as mentioned in this post https://stats.stackexchange.com/q/347074/208891
As it can be seen from the below 2 screenshots, sales are highest during mondays and when promotion=1. sales hit the bottom on sundays when promo=0
I found that, the series shows both weekly and yearly seasonality using the results of tbats:
yearly <- ts(store_578[,6], frequency=365) fit_yearly <- tbats(yearly) seasonal <- !is.null(fit_yearly$seasonal) weekly <- ts(store_578[,6], frequency=7) fit_weekly <- tbats(weekly) seasonal <- !is.null(fit_weekly$seasonal)
So, I created a multi seasonality time series
store_578_ts <- msts(store_578[,-1], seasonal.periods=c(7,365)) autoplot(store_578_ts[,5])
The resulting plot:
I built a dynamic harmonic regression model with fourier terms for multiple seasonality. To model the day of week effects that I mentioned above, I created 6 dummy variables (day1,day2..day6) and included them along with promotion and foruier terms
dummy<-cbind(Day1=store_578_ts[,"day1"],Day2=store_578_ts[,"day2"],Day3=store_578_ts[,"day3"],Day4=store_578_ts[,"day4"] ,Day5=store_578_ts[,"day5"],Day6=store_578_ts[,"day6"],promo=store_578_ts[,"Promo"]) xreg <- cbind(fourier(store_578_ts[,"Sales"], K = c(1,3)),dummy) fit_578 <- auto.arima(store_578_ts[,"Sales"], xreg = xreg, lambda=0,seasonal = FALSE, stationary = TRUE) Error in auto.arima(store_578_ts[, "Sales"], xreg = xreg, seasonal = FALSE, : No suitable ARIMA model found
Am I missing something here? I really need some help with this.
Note:It is able to get me a model if I use only weekly seasonality, instead of multiple.