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)


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)

  • $\begingroup$ I looked at using your predictor series BUT they were of little value .. I would use a robust version of CROSTON $\endgroup$ – IrishStat Oct 26 '17 at 12:53
  • $\begingroup$ @IrishStat - is there any literature or links to articles/publications where I can read and understand more about the 'robust version of Croston' you are suggesting? $\endgroup$ – Sid Verma Oct 27 '17 at 9:44
  • $\begingroup$ The precise procedure is proprietary to AFS but I can comment that it treats the data in a similar way to standard CROSTON but adjusts for Pulses and Level Shifts thus simultaneously discounting pulse anomalies and incorporating mean shifts. autobox.com/cms/images/dllupdate/AutoboxUsersguide.pdf Chapter 7 contains an overview $\endgroup$ – IrishStat Oct 27 '17 at 10:23

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.

  • $\begingroup$ Thank you for your upvote if it was yours. I do not know if I tagged you correctly due to the spaces between firstname and family name. Feel free to edit my answer. $\endgroup$ – Ferdi Oct 24 '17 at 9:07
  • 1
    $\begingroup$ It indeed was me, and I'll take the liberty of editing a bit. $\endgroup$ – S. Kolassa - Reinstate Monica Oct 24 '17 at 9:19
  • $\begingroup$ I highly appreciate the response @Ferdi and @Stephen! How can I apply external predictors (promotions, marketing etc.) in Croston's method? $\endgroup$ – Sid Verma Oct 24 '17 at 13:01
  • 1
    $\begingroup$ in the case of where you have external predictors you can often build what is called a Transfer Function or Dynamic Regression . These models allow not only contemporaneous response but lead and lag effects of the predictors. Why don't you post one of your data sets.. $\endgroup$ – IrishStat Oct 24 '17 at 16:30
  • $\begingroup$ @IrishStat thanks for the revert. I have added a dataset in the original question. $\endgroup$ – Sid Verma Oct 25 '17 at 11:46

One of the problems with Croston's method is that if there is a level shift in the demand rate or if there are unusual demand rates the suggested approach is often insufficient. A robust Croston-like procedure is available in AUTOBOX which I have helped to develop. The idea is to identify and to adjust for these kinds of violations.


This is an additional concept which can be implemented along with CROSTON, Rolling Forecast.

Can be used with any forecasting method. what it does is, at the time of forecasting it considers the most recent values and gives more weight-age, most likely to forecast better.

It is very helpful when implemented alongside Croston as for example: demand : 2,0,3,4,0,0,0,5,6

Now when you implement Croston with Rolling Window: 4, it considers something like this:

Croston gives more weight-age to 0,0,5,6 before predicting and these most recent 0's are given more importance than that of 0 which was in the start.

Hope this would be helpful for you!

For better understanding, can refer to https://robjhyndman.com/hyndsight/rolling-forecasts/, explained with an example.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.