Sales and demand are joined by one line: sales = min(demand, stock). On a day you run out, the sales figure records your stock, not the market. Statisticians call that a right-censored observation: the true value is at least what you recorded, and you do not know how much more.
I wrote about why this happens and how it feeds itself in a note about the sale you did not make. This one works it through with numbers.
Ten days, ten units on the shelf
Say true demand over ten days was 6, 9, 12, 8, 15, 7, 11, 10, 13, 9. Its average is exactly 10. You stock 10 units every morning.
Recorded sales are 6, 9, 10, 8, 10, 7, 10, 10, 10, 9. Their average is 8.9. The record understates demand by 11 percent, and 11 units of demand went unserved without leaving a trace.
Five days show sales of exactly 10. On four of them demand was higher. On one, demand was exactly 10. In the sales record those five days are identical. Nothing tells you which ones hid more demand.
What you can still measure exactly
The bottom of the distribution survives. Censoring only cuts values off at the stock level, so every question about demand below 10 has the same answer in the sales record as in the true demand.
| P(demand ≤ 7) | 0.2 true, 0.2 from sales |
|---|---|
| P(demand ≤ 8) | 0.3 true, 0.3 from sales |
| P(demand ≤ 9) | 0.5 true, 0.5 from sales |
| P(demand ≤ 10) | 0.6 true; the sales record cannot tell |
The average is wrong, but the shape of demand below the stock level is exactly right. That turns out to matter more than the average.
The stock level you actually need
For a product that spoils, the classical answer is the newsvendor rule. Write Cu for the cost of being one unit short, the margin you did not earn, and Co for the cost of one unit left over. Stock the amount where the probability of covering demand equals Cu / (Cu + Co).
Low margin first. Say each unit costs 6 and sells for 10: Cu = 4, Co = 6, ratio 0.4. You need the smallest stock that covers demand at least 40 percent of the time. P(demand ≤ 8) = 0.3 is not enough and P(demand ≤ 9) = 0.5 is, so the answer is 9. The censored record gives 9 as well. For this product, the biased data still leads to the right decision.
Now high margin. Say each unit costs 3 and sells for 10: Cu = 7, Co = 3, ratio 0.7. From the true demand, P(demand ≤ 10) = 0.6 is not enough and P(demand ≤ 11) = 0.7 is, so you should stock 11. The censored record cannot show that. It has never seen demand above 10, because you never had more than 10. You stay at 10, keep selling out, and the data keeps agreeing with you.
Why that is the trap
Censoring does not hurt every product equally. It hurts the ones where the right stock level sits above what you have been stocking, which are the products where running out is most expensive. Those are exactly the ones a sales-based forecast keeps under-ordering.
There are two ways out. The first is to record the requests you could not fill: date, item, quantity. Then the sell-out days stop being censored. The second is to stock above your usual level on purpose now and then, to see the demand you have been cutting off. The research on learning from censored demand does essentially that, adjusting stock as it learns rather than trusting the sales record alone.
References
- Huh, W. T. and Rusmevichientong, P. A Nonparametric Asymptotic Analysis of Inventory Planning with Censored Demand. Mathematics of Operations Research 34(1), 2009.
- Huh, W. T., Levi, R., Rusmevichientong, P. and Orlin, J. B. Adaptive Data-Driven Inventory Control with Censored Demand Based on Kaplan-Meier Estimator. Operations Research 59(4), 2011.