What Is the Dirichlet Distribution?
A sample from a Dirichlet distribution is a probability vector: its components are nonnegative and sum to one.
The vector lies in the standard simplex,
ΔK−1={x∈[0,1]K:i=1∑Kxi=1}.
Each such vector can serve as the probability parameters of a categorical or multinomial distribution. In this sense, the Dirichlet is a distribution over probability distributions on a fixed set of outcomes.
For K≥2 and parameters αi>0, its probability density function (PDF), evaluated in the interior of the simplex, is
f(x;α)=B(α)1i=1∏Kxiαi−1,xi>0,i=1∑Kxi=1.
The B Function
The multivariate beta function is the integral of the unnormalized density:
B(α)=∫ΔK−1j=1∏Kxjαj−1dx=Γ(α0)∏j=1KΓ(αj),α0=j=1∑Kαj.
Here the integral uses the K−1 free coordinates: dx=dx1⋯dxK−1, with xK=1−∑j=1K−1xj. Dividing by B(α) therefore makes the PDF integrate to one.
The gamma function Γ is defined, for t>0, by
Γ(t)=∫0∞ut−1e−udu.
We will use its recurrence Γ(t+1)=tΓ(t) to simplify the moments below.
Key Properties
For a given α, B(α) is a constant that makes the density integrate to one. Its shape is therefore determined by
f(x;α)∝i=1∏Kxiαi−1.
When α=(1,…,1), the product is constant, so the distribution is uniform over the simplex. A constant density need not equal one: it is 1 for K=2 and 2 for K=3.
Two Components
For K=2, x2=1−x1, so a line segment describes all possible vectors. The density of x1 is the Beta distribution. Adjust α1 and α2 below, or choose Uniform to see the constant density.
Three Components
For K=3, the simplex is a triangle. Each point represents a vector (x1,x2,x3); the color or height shows its density. Try Uniform, then change the parameters to see how the shape changes. Density is not point probability and can exceed one.
Mean and Variance
Let X∼Dirichlet(α), with total concentration
α0=j=1∑Kαj.
For each component, the mean and variance are
E[Xi]Var(Xi)=α0αi,=α02(α0+1)αi(α0−αi).
The proofs use parameter shifts in the B function.
Deriving the Mean
Let ei be the vector whose ith component is one and whose other components are zero. Multiplying by xi raises its exponent from αi−1 to αi, which replaces α with α+ei:
E[Xi]=B(α)1∫ΔK−1xij=1∏Kxjαj−1dx=B(α)B(α+ei)=Γ(αi)Γ(αi+1)Γ(α0+1)Γ(α0)=α0αi.
All other gamma factors cancel; the last step uses Γ(t+1)=tΓ(t).
Deriving the Variance
First compute the second moment. Multiplying by xi2 similarly increases αi by two:
E[Xi2]=B(α)B(α+2ei)=Γ(αi)Γ(αi+2)Γ(α0+2)Γ(α0)=α0(α0+1)αi(αi+1).
Now subtract the square of the mean:
Var(Xi)=E[Xi2]−(E[Xi])2=α0(α0+1)αi(αi+1)−α02αi2=α02(α0+1)αi(α0−αi).
Interpreting the Parameters
The relative sizes of the parameters determine the mean probability vector. If their proportions stay fixed, increasing their sum α0 reduces the variance and concentrates the distribution around that mean.
References: SciPy: Dirichlet distribution · Probability Distribution Explorer: moments.