Multivariate distribution
Multinomial distribution
The counts in each of categories after independent categorical draws: how many of voters pick each party, how often each word appears in a document of words, the faces of a die rolled times. With it is the binomial. The plot shows : the colour of each cell is the probability of in the first category and in the second (the third gets the rest).
Joint PMF of (X₁, X₂)
E[X₁] = 2 · E[X₂] = 5 · Var X₁ = 1.6 · Var X₂ = 2.5 · Cov = −1 · corr = −0.5
Formulas
| Parameters |
|
|---|---|
| Support | |
| PMF | |
| CDF | |
| Mean | |
| Variance | |
| Mode | |
| MGF |
The covariances are negative: with fixed, more in one category leaves less for the others.
Worked example
In a town 20% vote A, 50% vote B and 30% vote C. Ten voters are picked at random. What is the probability of exactly 2 A, 5 B and 3 C?
Even the most likely split happens less than one time in ten. answer checked by code
How it relates to others
- Sum← Categorical: The counts of each outcome in independent categorical draws are Multinomial(). checked by code
- Special case→ Binomial: Multinomial with is the binomial, and any single count of a multinomial is Binomial(). checked by code
- Conjugate prior← Dirichlet: A Dirichlet() prior and multinomial counts give a Dirichlet() posterior. checked by code
All the relationships, as a diagram →
In Python
from scipy import stats
import numpy as np
X = stats.multinomial(n=10, p=[0.2, 0.5, 0.3])
X.pmf([2, 5, 3]) # probability here: 0.08505
X.mean(), X.cov()
X.rvs(size=5, random_state=0)
rng = np.random.default_rng(0)
rng.multinomial(n=10, pvals=[0.2, 0.5, 0.3], size=5)Choosing between this and its neighbours? Which distribution for count data? · Which prior distribution should I use?