Solved – How to forecast demand with time series and/or other models

arimacrostons-methodforecastingtime serieszero inflation

I need to forecast data which has many periods of zero demand, also there is no seasonality or trend in the data.

I tried ARIMA, but it converges to the mean. I also applied some predictors, but they don't affect the forecast significantly. What forecasting methods should I use?

Below is my dataset

Time series:

sales <-c(0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

Predictors:

sales$dayOfWeek <- c(5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2)

sales$promo <- c(10,20,15,10,15,10,20,10,20,15,10,15,10,20,10,20,15,10,15,10,20,10,20,15,10,15,10,20,10,20,15,10,15,10,20,10,20,15,10,15,10,20,10,20,15,10,15,10,20,10,20,15,10,15,10,20,10,20,15,10,15)

sales$marketing <- c(1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0)

Best Answer

You can use Croston's method method for forecasting. Croston's method was developed for cases like yours. Forecasting demand when many variables are zeros. It is implemented with the crost() command from the forecast package in R.

It is well explained in the following questions:

Analysis of time series with many zero values

Explain the croston method of R

The latter question was brilliantly answered by Stephan Kolassa. Here is the most basic part of his answer.

Note that Croston's method does not forecast "likely" periods with nonzero demands. It assumes that all periods are equally likely to exhibit demand. It separately smoothes the inter-demand interval and nonzero demands via Exponential Smoothing, but updates both only when there is nonzero demand. The in-sample fit and the point forecast then essentially is the ratio of smoothed nonzero demand, divided by the inter-demand interval (unless there is some kind of Syntetos-Boylan bias correction going on).

You can find the original paper from Croston.

I also recommend you reading the following paper by Shenstone and Hyndman and you can have a look at all the question with the tag.