# Safety stock for log-normal distribution demand

I came across this example on how to model your lead time demand as a log-normal distribution and calculate the safety stock. https://www.linkedin.com/pulse/why-you-keep-missing-your-service-level-targets-stefan-de-kok/

I don't understand the part where the author calculates 78 units of safety stock when modelling the demand as log-normal with $$\mu = 2.645$$ and $$\sigma = 0.83255$$ nor the part where he uses a cauterized normal distribution. Can someone help me out with this?

To calculate the base-stock to meet a 99% type-1 service level, we need the 0.99 fractile of the demand distribution. The safety stock level is the base-stock level minus the mean demand.

For the lognormal case, the author has fit a lognormal distribution and found that the parameters are $$\mu=2.645$$ and $$\sigma=0.83255$$. (Note that for a lognormal distribution, $$\mu$$ and $$\sigma$$ are not the mean and SD.)

For a lognormal distribution with those parameters, the mean is 19.9169 and the 99th quantile is 97.6902. The difference between the two is the safety stock (approx. 78).

Here's some Python code to calculate all of this:

from scipy.stats import lognorm
import numpy as np

mu = 2.645
sigma = 0.83255

s = sigma
scale = np.exp(mu)

mean_demand = lognorm(s=s, scale=scale).mean()
# 19.916922579681707
base_stock = lognorm(s=s, scale=scale).ppf(0.99)
# 97.69016830710534
base_stock - mean_demand
# 77.77324572742363


(For more on the parameters of lognorm, see here.) I didn't work through the "cauterized normal" case in detail, but roughly speaking the logic should be the same. When he says "cauterized normal" I think he means that we take the probability in the tail below 0 and add a probability mass at 0, with that probability.

• Very well explained. Thanks a lot! – Nishant Kumar Gupta May 4 '20 at 16:46