# What distribution should be used for the detection of out of shelf situations in a retail stores?

I need to detect Out Of Shelf situations in reatil stores. What I had in mind is to assume that purchase frequency of some article (SKU) has certain ditribution (I tried with Poisson) and then calculate probability (according to that distribution) of that specific article was not bought since last purchase, and if that probability is below some treshold (let say 1%) then it is a possible OOS situation.
My question is:
What distributions are commonly used in such problems and is there any way that one can test for several distributions and than pick the best one? Thing is, this should be done automatically due to large number of SKU/store combinations to deal with.

Poisson makes a certain amount of sense if "purchase frequency" is e.g. number of items bought per day. Negative binomial would also make sense (probably more sensible, as it will allow for more variation). If you have a huge amount of data, then you could just use the empirical distribution (i.e. across days, what is the empirical frequency of <= this number being bought?)

A couple of things that make sense to consider in this context (don't know how much effort you are going to be putting into this, nor what your statistical background is): (1) it would make sense to fit a mixed model to allow for variation among stores, SKUs, days, etc.; (2) you might want to use more than just zeros -- i.e. if there were really only 2 items there to begin with, then there will only be 2 bought, and you could potentially detect that that outcome was highly unlikely for that particular SKU/store/day combination ... and hence detect the OOS issue before the next day (when there were zero and hence zero bought).

• I planned to estimate lambda for each store/SKU separately. (1) What did you have in mind regarding mixed models, and what are mixed models :)? I must mention that I'm dealing with very different stores (from 50 sq m to 1500 sq m) with very different turnovers. this is reason why I looked each store separately. (2) I planned to adress this problem with modelling sales per hour. You asked me about my statistical background Well, I have some basic knowledge about mathematical statistics (common distributions, statistical tests, etc..). – acroa Dec 13 '10 at 11:30
• If you've got enough data, then estimating lambda for each store/SKU separately should be OK. Mixed models (multilevel, hierarchical) are models that assume that the lambdas for SKUs are themselves random variables, drawn from a distribution. See e.g. Gelman and Hill (2009? I forget the title etc -- something about multilevel regression modeling) – Ben Bolker Dec 13 '10 at 16:12
• Thanks for directions. Just one more thing, does using this mixed models have sense when dealing with high differences between demand, or should one first group stores and then use it on these groups? – acroa Dec 14 '10 at 9:23
• With some programs (such as lme4) you can fit crossed effects, i.e. fitting a parameter for each store (deviation from average demand), for each SKU (deviation from average demand), and for each store:SKU combination (deviation from expectation based on store and SKU). – Ben Bolker Dec 14 '10 at 13:07
• thx Ben. you have been of great help.. I think that i will post some questions about mixed modelling when i study it a bit :) – acroa Dec 14 '10 at 15:25

The key idea to detect OOS is that you need the most accurate demand forecast, typically at the SKU level per store and per day. Indeed, the distribution of the demand is not stable over time: you have to take into account many patterns such as

• day of the week,
• yearly seasonality,
• promotions,
• ...

Then, once you have your high-quality forecasting model, you will typically focus on the distribution of error. It's through the analyse this distribution that you will be able to figure the thresholds for your alerts.

Shameless plug: our product Shelfcheck is precisely designed to detect out-of-shelf in Retail.