Skip to main content

Safety stock — theory and calculation

What safety stock is, why the classic formula fails when its assumptions do not hold, and how AInventory computes it from the scenarios.

What safety stock is

Safety stock is the inventory held above expected demand during the lead time and review period, as a buffer against uncertainty. Intuitively:

SS ≈ target stock B − expected demand in window W

For policies that use the k factor, this is equivalent to:

SS = k · σ_W

where σ_W is the variability of demand in window W = lead time + review period. A higher k produces more safety stock and therefore a higher fill rate; a lower k reduces tied-up inventory at the cost of higher stockout risk.

The classic formula and its assumptions

The standard formulation found in most ERP systems and textbooks is:

SS = z · σ_d · √L

where z is the Normal quantile for the desired service level, σ_d is the standard deviation of daily/weekly demand, and L is the lead time in the same periods.

This formula rests on three assumptions that are rarely satisfied in practice:

  1. Normal, symmetric demand. The real demand of many SKUs — especially slow-movers, seasonal items, or B2B markets — is asymmetric or has heavier tails than the Normal. Using z · σ underestimates the safety stock needed to cover the high percentiles.

  2. Unbiased forecast. If the forecast systematically overestimates or underestimates demand, the classic formula passes that bias directly into the target stock. A biased forecast with a small σ can be more dangerous than a noisy but centered one.

  3. Uniform treatment regardless of history. The classic formula applies the same structure to a new product with three weeks of sales and a mature one with three years. In the first case, σ_d is estimated with high uncertainty; in the second, that uncertainty is manageable. Ignoring this difference produces safety stocks that appear rigorous but are systematically suboptimal.

When those assumptions fail — which is almost always the case in practice — the formula produces decisions that look correct but are systematically biased.

How AInventory solves it

Rather than estimating σ directly from the demand history and multiplying by z, AInventory computes σ_W from the Monte Carlo scenarios:

  1. The four-level statistical cascade determines the appropriate method based on the SKU's history (parametric or non-parametric bootstrap).
  2. ~1,000 scenarios of future demand are generated over window W, consistent with the observed uncertainty of the SKU.
  3. σ_W is computed as the standard deviation of the total simulated demands across those scenarios.

The resulting σ_W:

  • Reflects the actual distribution of demand (including asymmetries and tails), not a Normal approximation.
  • Is consistent with available history: with little history it uses explicit distributional assumptions; with rich history it lets the data speak.
  • Incorporates forecast uncertainty in an integrated way, because scenarios are generated from historical forecast errors, not from raw demand.
σ_W vs the classic formula's σ

σ_W is not the historical demand standard deviation scaled by √W. It is the standard deviation of the total simulated demand in W, derived from the scenario bundle. The two quantities coincide when demand is Normal and i.i.d.; in all other cases, σ_W is more accurate.

Safety stock as a result, not a target

In AInventory, safety stock is not configured directly. It is a result of the policy that minimized expected total cost: the optimizer chooses the policy and k value that balance the holding cost (holding inventory that may not sell) against the shortage cost (lacking inventory when it is needed). The safety stock that results from that balance may be higher or lower than what the classic formula would suggest, depending on relative costs and the real demand distribution.

This means the planner can observe the implied safety stock in the recommendation, but there is no "enter your desired safety stock" field: that design would transfer to the planner an optimization decision the model can make with more information.