Multivariate distribution
Dirichlet distribution
A random vector of proportions that add to 1: the topic mix of a document, the market shares of firms, an unknown set of category probabilities. It is the conjugate prior for the categorical and multinomial: after observing counts the posterior is Dirichlet(). With it is the beta. The plot shows over the first two proportions; the third is , so the density lives on the triangle.
Joint density of (X₁, X₂)
E[X₁] = 0.2222 · E[X₂] = 0.3333 · Var X₁ = 0.01728 · Var X₂ = 0.02222 · Cov = −0.007407 · corr = −0.378
Formulas
| Parameters |
|
|---|---|
| Support | |
| CDF | |
| Mean | |
| Variance | |
| Mode | |
| Entropy |
Each coordinate on its own is Beta. Small s (below 1) push the mass to the corners, sparse mixtures; large ones concentrate it near the mean.
Worked example
Topic proportions for a document follow Dirichlet(2, 3, 4). What are the mean and variance of the first topic's share?
, so and answer checked by code
How it relates to others
- Special case→ Beta: Dirichlet with is the beta, and each coordinate of a Dirichlet is Beta(). checked by code
- Conjugate prior→ Categorical: The Dirichlet is the conjugate prior for categorical probabilities: observing outcome adds 1 to .
- Conjugate prior→ Multinomial: 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.dirichlet(alpha=[2, 3, 4])
X.pdf([0.2, 0.3, 0.5]) # density here: 7.56
X.mean(), X.var()
X.rvs(size=5, random_state=0)
rng = np.random.default_rng(0)
rng.dirichlet(alpha=[2, 3, 4], size=5)Choosing between this and its neighbours? Which distribution for proportions and probabilities? · Which prior distribution should I use?