Definition
The Poisson distribution has one parameter, its mean μ, and its variance is also μ. The negative binomial has a second parameter that lets the variance exceed the mean:
Poisson: Var = μ negative binomial: Var = μ + μ² ÷ r
The ratio of the variance to the mean is a first diagnostic. Near 1, a Poisson distribution is plausible. Well above 1, the data show overdispersion and Poisson quantiles are too low. Snyder, Ord and Beaumont found the negative binomial preferable to the Poisson on slow-moving car parts.
Worked example
Customers arrive at random and each orders a variable number of units. Both distributions are fitted by matching moments on a training sample, and their 95 % quantile is checked on new data.
import numpy as np
from scipy import stats
rng = np.random.default_rng(14)
def draw(n):
orders = rng.poisson(1.5, n) # customers per period
return np.array([rng.geometric(0.4, k).sum() for k in orders]) # units per customer: 1, 2, 3...
train, test = draw(500), draw(100_000)
m, v = train.mean(), train.var(ddof=1)
print(f"mean = {m:.2f} variance = {v:.2f} variance / mean = {v / m:.2f}")
q_pois = stats.poisson.ppf(0.95, m)
r = m * m / (v - m)
q_nb = stats.nbinom.ppf(0.95, r, r / (r + m))
for name, q in [("Poisson", q_pois), ("negative binomial", q_nb)]:
print(f"{name:18s} 95 % quantile = {q:.0f} share of new periods covered = {np.mean(test <= q):.3f}")Output, produced by running the code above when this page was built:
mean = 3.84 variance = 14.78 variance / mean = 3.84 Poisson 95 % quantile = 7 share of new periods covered = 0.849 negative binomial 95 % quantile = 11 share of new periods covered = 0.951
The variance is several times the mean. The Poisson quantile covers fewer periods than the 95 % it was built for; the negative binomial quantile is higher and closer to the target.
Where it misleads
- On a short history the variance is poorly estimated, and the fitted variance can even fall below the mean, where the negative binomial does not exist. A fallback to the Poisson has to be written in the code and counted in the report.
- Neither distribution has enough zeros for some items. Zero-inflated and hurdle variants add a separate probability of no demand.
- A good fit on the bulk of the data does not guarantee the tail. The quantile used for stock should be scored on data held out, with the pinball loss and coverage.
The choice of distribution matters less than the quality of the mean it is centred on. A well-chosen distribution placed on a biased mean gives a biased quantile.
In our work
We test the distribution and the mean forecast separately. In our study on 2,404 spare-part series, changing the point forecast under a Poisson quantile moved the quantile loss more than changing the distribution did.
Service: forecasting and statistical studies Research note: intermittent demand forecasting, measured
References
- Snyder, R. D., Ord, J. K., Beaumont, A. (2012). Forecasting the intermittent demand for slow-moving inventories: a modelling approach. International Journal of Forecasting, 28(2), 485-496. doi:10.1016/j.ijforecast.2011.03.009
- Kolassa, S. (2016). Evaluating predictive count data distributions in retail sales forecasting. International Journal of Forecasting, 32(3), 788-803. doi:10.1016/j.ijforecast.2015.12.004
- Agrawal, N., Smith, S. A. (1996). Estimating negative binomial demand for retail inventory management with unobservable lost sales. Naval Research Logistics, 43(6), 839-861. doi:10.1002/(SICI)1520-6750(199609)43:6<839::AID-NAV4>3.0.CO;2-5