Hi all,

Having read "The Quantitative Supply Chain" and some documentation from Lokad, I have a question regarding the integrated demand equation. According to Lokad's documentation, the equation for integrated demand is:

$$ D : (d,\Lambda,t_1) = \sum_{j = 1}^{\infty} P[\Lambda = j] (\sum_{i = 1}^{j} d(t_i)) $$

Where $d(t_i)$ should be understood as a probabilistic demand forecast.

I understand this equation as the following (and please correct me if I'm mistaken), "For each possible lead time, let's find the expected value of the demand during that lead time, weight that demand by the probability of that lead time occurring, and sum up each of these values". This is all very logical to me; we take into account the uncertainty in our demand and lead time forecasts and create a "per lead time" forecast (rather than per day, week, month, etc.). However, in the end, won't this equation lead us to a point estimate for the integrated demand?

Instead, can't we create a simulation where we draw samples from our lead-time forecast distribution and our demand forecast distributions (we will have multiple, in order to match the maximum possible lead-time), multiply them together, and create a new integrated demand distribution? From there, we can perhaps use bootstrapping to find the mean and 95% confidence interval of this distribution. I believe this would be more desirable than having a point estimate. Am I missing anything?

Thanks,
Tom

vermorel Apr 03, 2023 | flag

Yes, this part has been somewhat hastily written (my fault). At Lokad, we tend to alternate between the algebra of random variables (faster, more reliable) and the montecarlo approach (more expressive). Here, is below the typical way we approach this integrated demand over the lead time while producing a probabilistic forecast at the end (this is very much aligned with your "simulation" approach):


present = date(2021, 8, 1)
keep span date = [present .. date(2021, 10, 30)]
 
Day.Baseline = random.uniform(0.5 into Day, 1.5) // 'theta'
alpha = 0.3
level = 1.0 // initial level
minLevel = 0.1
dispersion = 2.0

L = 7 + poisson(5) // Reorder lead time + supply lead time

montecarlo 500 with
  h = random.ranvar(L)

  Day.Q = each Day scan date // minimal ISSM
    keep level
    mean = level * Day.Baseline
    deviate = random.negativebinomial(mean, dispersion)
    level = alpha * deviate / Day.Baseline + (1 - alpha) * level
    level = max(minLevel, level) // arbitrary, prevents "collapse" to zero
    return deviate

  s = sum(Day.Q) when (date - present <= h)
  sample d = ranvar(s)

show scalar "Raw integrated demand over the lead time" a4d6 with d
show scalar "Smoothed integrated demand over the lead time" a7d9 with smooth(d)

See also https://try.lokad.com/s/demand-over-leadtime-v1 if you want to try out the code.