This is an old version, view current version.

## 15.2 Multinomial Distribution, Logit Parameterization

Stan also provides a version of the multinomial probability mass function distribution with the $$\text{K-simplex}$$ for the event count probabilities per category given on the unconstrained logistic scale.

### 15.2.1 Probability Mass Function

If $$K \in \mathbb{N}$$, $$N \in \mathbb{N}$$, and $$\text{softmax}^{-1}(\theta) \in \text{K-simplex}$$, then for $$y \in \mathbb{N}^K$$ such that $$\sum_{k=1}^K y_k = N$$, $\text{MultinomialLogit}(y|\theta) = \text{Multinomial}(y|\text{softmax}^{-1}(\theta)) = \binom{N}{y_1,\ldots,y_K} \prod_{k=1}^K [\text{softmax}^{-1}(\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.2.2 Sampling Statement

y ~ multinomial_logit(theta)

Increment target log probability density with multinomial_logit_lpmf(y | theta) dropping constant additive terms.

### 15.2.3 Stan Functions

real multinomial_logit_lpmf(int[] y | vector theta)
The log multinomial probability mass function with outcome array y of size $$K$$ given the $$K$$-simplex distribution parameter $$\text{softmax}^{-1}(\theta)$$ and (implicit) total count N = sum(y)

int[] multinomial_logit_rng(vector theta, int N)
Generate a multinomial variate with simplex distribution parameter $$\text{softmax}^{-1}(\theta)$$ and total count $$N$$; may only be used in transformed data and generated quantities blocks