Definition
Let cu be the underage cost, the cost of one unit of unmet demand (the margin lost), and co the overage cost, the cost of one unit left over (purchase cost minus salvage value). The expected cost is minimised by the quantity q such that:
P( D ≤ q ) = cu ÷ ( cu + co )
The right-hand side is the critical ratio. The optimal order is the quantile of demand at that probability. The result goes back to Arrow, Harris and Marschak in 1951. It is the reason a stock forecast is a quantile forecast: the expected cost of an order q is, up to a constant, the pinball loss at the critical ratio.
Worked example
A product is bought at 4, sold at 10 and unsold units are worth 2. Running short costs 6 a unit, excess costs 2, so the critical ratio is 0.75. Demand is uncertain and skewed.
import numpy as np
rng = np.random.default_rng(13)
demand = rng.negative_binomial(n=4, p=0.1, size=200_000) # mean 36, long right tail
price, cost, salvage = 10.0, 4.0, 2.0
cu, co = price - cost, cost - salvage
ratio = cu / (cu + co)
def profit(q):
sold = np.minimum(demand, q)
return np.mean(price * sold + salvage * (q - sold) - cost * q)
grid = np.arange(10, 91)
best = grid[int(np.argmax([profit(q) for q in grid]))]
print(f"critical ratio = {ratio:.2f}")
print(f"mean demand = {demand.mean():.1f} median = {np.median(demand):.0f} {ratio:.2f} quantile = {int(np.quantile(demand, ratio))}")
print(f"order with the highest expected profit = {best}")
print(f"expected profit: order the mean = {profit(round(demand.mean())):.1f}, order the optimum = {profit(best):.1f}")Output, produced by running the code above when this page was built:
critical ratio = 0.75 mean demand = 36.0 median = 33 0.75 quantile = 47 order with the highest expected profit = 47 expected profit: order the mean = 156.7, order the optimum = 164.0
The order with the highest expected profit is the 0.75 quantile of demand, above the mean. Ordering the mean leaves profit on the table because a missed sale costs three times more than a leftover unit.
Where it misleads
- The model covers one period and one order. With replenishment, leftover stock is used later and the overage cost becomes a holding cost per period: the ratio changes, the quantile logic stays.
- The cost of a missed sale is rarely known. A lost customer, a penalty or a line stopped for a missing part are worth more than the margin of the unit. The ratio is then a management choice, and it should be written down.
- The optimum is only as good as the demand distribution. With a quantile that is wrong, the formula optimises the wrong order with full confidence.
In our work
We ask for the two unit costs at the start of a stock project, or for the service level that stands in for them, because they set the quantile the forecast has to get right.
Service: forecasting and statistical studies Research note: intermittent demand forecasting, measured
References
- Arrow, K. J., Harris, T., Marschak, J. (1951). Optimal inventory policy. Econometrica, 19(3), 250-272. doi:10.2307/1906813
- Silver, E. A., Pyke, D. F., Thomas, D. J. (2017). Inventory and production management in supply chains, 4th edition. CRC Press, Boca Raton. doi:10.1201/9781315374406
- Gneiting, T., Raftery, A. E. (2007). Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association, 102(477), 359-378. doi:10.1198/016214506000001437