# Overdispersed alternative to multinomial

**URL:** https://discourse.julialang.org/t/overdispersed-alternative-to-multinomial/134533
**Category:** Statistics
**Tags:** question, distributions
**Created:** [December 13, 2025, 4:48pm UTC](https://discourse.julialang.org/t/overdispersed-alternative-to-multinomial/134533 "2025-12-13T16:48:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [December 13, 2025, 4:48pm UTC](https://discourse.julialang.org/t/overdispersed-alternative-to-multinomial/134533/1 "2025-12-13T16:48:04Z")

</div>

I have a multilevel Bayesian model where (a\_i, b\_i, c\_i) = f(\theta\_i) for each unit i = 1, \dots, 1000, which are latent variables, f comes from a model.

For each i, and j = 1, 2, 3, I observe (A\_{i,j}, B\_{i,j}, C\_{i,j}), where

1. A, B, C are _positive integers_, summing to K (eg K = 80 or similar),
2. are IID given i,
3. E[A\_{i,j}] = a\_i, E[B\_{i,j}] = b\_i, E[C\_{i,j}] = c\_i,

The _multinomial distribution_ would be ideal for this, except that I found that my data has much more dispersion.

I am looking for a cheap way to implement an _overdispersed_ discrete distribution with these properties + at least one parameter to control overdispersion (actually one would be plenty). I only need `logpdf` (should be ADable, fast, A,B,C are data), and `rand` (for checking, can be slow). I looked at various papers but they involve a latent variable, which would blow up my parameter space.

---

<div class="post-metadata">

### Author: ![rsenne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rsenne/32/212973_2.png) [@rsenne](https://discourse.julialang.org/u/rsenne)
#### Post date: [December 16, 2025, 10:58pm UTC](https://discourse.julialang.org/t/overdispersed-alternative-to-multinomial/134533/2 "2025-12-16T22:58:34Z")

</div>

I think you want the [Dirichlet-Multinomial Distribution](https://en.wikipedia.org/wiki/Dirichlet-multinomial_distribution)?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [December 20, 2025, 3:27pm UTC](https://discourse.julialang.org/t/overdispersed-alternative-to-multinomial/134533/3 "2025-12-20T15:27:25Z")

</div>

Thanks, that looks like a good alternative, I was not aware of it. There is an implementation in Distributions.jl, though not listed in the manual, and it looks like I will have to extend it to work with `SVector`s to avoid allocations.
