Home » Knowledgebase » Here

The approach detailed below is a several decades old classic, however recent developments of Lokad around quantile forecasts are now making the *safety stock* model somewhat obsolete. Indeed, the reorder point is nothing but a quantile forecast. Hence a *direct* calculation of the quantile vastly outperform, on average, an *indirect* calculation, as provided by the safety stock model.

This guide explains We have tried to keep the mathematical requirements as low as possible, yet we can’t really avoid all formula altogether since the precise purpose of this document is to be a practical guide that explains how to compute safety stock.

Inventory stock depends essentially of two factors

- demand: the amount of items that will be consumed or bought.
- lead time: the delay between reorder decision and renewed availability.

Yet those two factors are subject to uncertainties

- demand variations: customer behaviors can evolve in rather unpredictable ways.
- lead time variations: suppliers or transporters may be faced with unplanned difficulties.

Deciding the level of safety stock is implicitly equivalent to making a trade-off between those costs considering the uncertainties.

The balance inventory costs vs. stock-outs costs is very business dependent. Thus, instead of considering those costs directly, we will now introduce the classical notion of

The

Choosing the service level, i.e. the acceptable probability of stock-out, is beyond the scope of this guide, but we have a separate guide about calculating optimal service levels.

Get optimized safety stocks with our inventory forecasting technology. Lokad specializes in inventory optimization through demand forecasting. The content of this tutorial - and much more - are native features of our forecasting engine tool.

Lokad provides many tools to compute the lead time demand directly from the historical data. You can have a look at our Forecasting Methods and Formulas with Microsoft Excel.

In practice, because of the uncertainties, we have

`reorder point = lead time demand + safety stock`

If we assume that the forecasts are

A normal distribution is only defined by two parameters: its mean and its variance. Since we assume the forecasts to be unbiased,

Determining the variance of the forecast error is a more delicate task. Lokad, as most forecasting toolkits, provides MAPE estimations (Mean Absolute Percentage Error) associated to its forecasts. For the sake of completeness, we will explain how simple heuristics can be used to overcome this problem.

In particular, the

`σ`^{2} = E[ (y_{t} - y')^{2} ]

where

`E`

is the `y`_{t}

is the historical demand for the period `t`

(typically the amount of sales) and `y'`

the forecasted demand.The key idea behind this assumption is that the forecast error is very often correlated to the amount of expected variation:

Actually, the computation of this error variance involves a few subtleties that will be treated in greater details below.

In order to convert the service level into an

Intuitively, we calculate

`safety stock = standard deviation of error * service factor`

More formally, let

`S`

be the safety stock, we have`S = σ * icdf(P) `

where

`σ`

is the standard deviation (i.e. the square root of `σ`^{2}

the variance defined here above), `cdf`

the `P`

the service level.Remembering that

`reorder point = lead time demand + safety stock`

Let

`R`

be the reorder point, we have`R = y' + σ * icdf(P)`

Yet, the chosen period may not exactly match the lead time; thus, some further calculations are required to express the lead time demand and its associated variance (considering that we are still assuming a normal distribution for the forecast error, as detailed in the previous section).

Intuitively,

Formally, let

`T`

be the period and `L`

the lead time. We write`L = k * T + α * T`

where

`k`

integer and `0 ≤ α < 1`

.
Let `D`

be the lead time demand. Then, we have the final expression for the lead time demand`D = (Σ`_{t=1..k} y'_{t}) + αy'_{k+1}

where

`y'`_{n}

is the forecasted demand for the `n`^{th}

period in the future.Considering the same normal distribution assumptions, we can compute the forecast error variance as

`σ`^{2} = E[ (y_{t} - y')^{2} ]

where

`y'`

the average forecast per period `y'= D / (k + α)`

Yet,

`σ`^{2}

is computed here as a `σ`_{L}^{2}

be the adjusted `σ`_{L}^{2} = (k + α) σ^{2}

Finally, we can re-express the reorder point as

`R = D + σ`_{L} * cdf(P)

The sample sheet is basically split into two sections: the

Most of the formulas introduced in the previous section are very plain operations (additions, multiplications) that are very easy to perform with Microsoft Excel. Yet, two functions are noticeable

`NORMSINV`

(Microsoft KB): estimates the cumulative normal distribution, noted`cdf`

here above.`STDEV`

(Microsoft KB): estimates standard deviation, noted`σ`

here above. We recall that the standard deviation`σ`

is the square root of the variance`σ`

.^{2}

For the sake of simplicity, the first sheet does not implement the heuristic

`σ`^{2} = E[ (y_{t} - y')^{2} ]

when calculating the service factor. This approach is implemented in `Sheet2`

(2nd spreadsheet of the Excel document). Since we have assumed stationary forecasts in the example, the reorder point remains identical with or without this heuristic.Most of the formulas expressed in this guide can be concisely implemented with regular development tools. If you happen to work with .NET, we suggest to use Math.NET Iridium an open-source mathematical library written in C# that provides both the standard deviation operator and the cumulative normal distribution function.

Otherwise, the standard deviation can be easily re-implemented based on its definition, see the Wikipedia page. The cumulative normal distribution is slightly more complicated, but Peter J. Acklam provides a good algorithm that has been implemented in many languages. The code dedicated to those two methods should not require more than a few dozens of lines.

- ABC analysis
- Backorders
- Business Drivers
- Container shipments
- Economic order quantity
- Fill Rate
- Financial impact of accuracy
- Inventory accuracy
- Inventory control
- Inventory costs (carrying costs)
- Inventory turnover
- Lead time
- Lead demand
- Min/Max Planning
- Minimal Order Quantities (MOQ)
- Multichannel Order Management
- Optimal service level formula
- Perpetual Inventory
- Phantom Inventory
- Prioritized Ordering
- Product life-cycle
- Reorder point
- Replenishment
- Safety stock
- Service level
- Stock-keeping unit (SKU)
- Stock Reward Function

- Backtesting
- Continous Ranked Probability Score
- Data preparation
- Forecasting accuracy
- Forecasting methods
- Obfuscation
- Overfitting
- Pinball loss function
- Probabilistic forecasting
- Quantile regression
- Seasonality
- Time-series

- Bundle Pricing
- Competitive Pricing
- Cost-Plus Pricing
- Decoy Pricing
- Long-term maintenance agreement pricing
- Long-term pricing strategies
- Odd Pricing
- Penetration Pricing
- Price Elasticity of Demand
- Price Skimming
- Repricing software (Repricer)
- Styling Prices for Retail