15.1 Multinomial Distribution
15.1.1 Probability Mass Function
If \(K \in \mathbb{N}\), \(N \in \mathbb{N}\), and \(\theta \in \text{$K$-simplex}\), then for \(y \in \mathbb{N}^K\) such that \(\sum_{k=1}^K y_k = N\), \[ \text{Multinomial}(y|\theta) = \binom{N}{y_1,\ldots,y_K} \prod_{k=1}^K \theta_k^{y_k}, \] where the multinomial coefficient is defined by \[ \binom{N}{y_1,\ldots,y_k} = \frac{N!}{\prod_{k=1}^K y_k!}. \]
15.1.2 Sampling Statement
y ~
multinomial
(theta)
Increment target log probability density with multinomial_lupmf(y | theta)
.
15.1.3 Stan Functions
real
multinomial_lpmf
(int[] y | vector theta)
The log multinomial probability mass function with outcome array y
of size \(K\) given the \(K\)-simplex distribution parameter theta and
(implicit) total count N = sum(y)
real
multinomial_lupmf
(int[] y | vector theta)
The log multinomial probability mass function with outcome array y
of size \(K\) given the \(K\)-simplex distribution parameter theta and
(implicit) total count N = sum(y)
dropping constant additive terms
int[]
multinomial_rng
(vector theta, int N)
Generate a multinomial variate with simplex distribution parameter
theta and total count \(N\); may only be used in transformed data and
generated quantities blocks