Return a draw from a Dirichlet-Multinomial distribution with specified parameters \(\alpha\) and \(N\) and pseudo-random number generator rng.
The Dirichlet-Multinomial distribution is a continuous mixture of Multinomial distirbutions, where the mixing distribution is the Dirichlet distribution. This fact is used for generating DirMult random draws. First, we sample a probability vector \(\theta \sim \mbox{Dirichlet}(\alpha)\). Then, we sample a \(n \sim \mbox{Multinomial}(\theta, N)\), and return \(n\).
- Template Parameters
-
RNG | type of pseudo-random number generator |
- Parameters
-
alpha | Prior sample sizes (or intensity vector). |
N | Number of trials. |
rng | Pseudo-random number generator. |
- Returns
- A non-negative integer vector n with sum(n) = N.
- Exceptions
-
std::domain_error | if any element of alpha is less than or equal to 0, or infinite. |
std::domain_error | is N is less than 0. |
Definition at line 37 of file dirichlet_multinomial_rng.hpp.