smooth in Python: iETS and the Croston’s Method

Is there a statistical model underlying Croston’s method? This question has been bothering researchers for decades. Croston proposed his method back in 1972, and some even argued that there is no sensible model behind it (Shenstone & Hyndman, 2005). Yet there is one! Let me explain.

But first, why bother? Because a method just gives you a number, while a model gives you a likelihood, and with it flexibility: you can select components and features via information criteria, get predictive distributions, and extend the model however you like. So, if you derive a model underlying a method, you bring that method to another level.

A quick recap. Croston split intermittent demand into two parts: how often the product sells (demand intervals) and how much it sells when it does (demand sizes), and applied Simple Exponential Smoothing (SES) to each of them. In my previous post, I showed the simplest model for the “how often” part, which assumes that the chance of a sale does not change over time.

A more complicated statistical model was proposed by John Boylan and me in our iETS paper. It assumes that the occurrence of sales follows a Bernoulli distribution with a time-varying probability. In the “inverse-odds-ratio” version of the model, we track the expected number of periods without sales: if the gap between sales is 4 periods then the probability of a sale is 1/4. Every new zero or one is converted into an error term, and this expected number is updated via ETS(M,N,N), the model underlying SES. When the probability does not change much over time, this model can be estimated with Croston’s method, which is why it can be considered as the model underlying it.

In Python, the basic model is done like this:

from smooth import OM, ADAM

occ = OM(model="MNN", occurrence="inverse-odds-ratio")
occ.fit(y)
model = ADAM(model="MNN")
model.fit(y, occurrence=occ)
model.predict(h=10, interval="prediction")

In the paper, we also showed that this model is especially suitable for new products with demand building up. This means that the gaps between sales become shorter and shorter, i.e. the demand transforms from intermittent to regular. If you expect this to continue in the holdout period, you can use the trend model, and here how to do that in Python:

occ = OM(model="MMN", occurrence="inverse-odds-ratio")

This way, the expected gap between sales would decline in the holdout period, and the probability of a sale would grow. The image in this post shows how this works on an artificial example.

And if you know what drives sales (e.g. promotions or price changes), you can include this information in the occurrence model as well.

So, yes, there is a model underlying Croston’s method, and it allows doing things that the method itself cannot do.

Try smooth for Python: pip install smooth
Occurrence model on wiki

Leave a comment