![]() | ||
Parameters K ≥ 2 {displaystyle Kgeq 2} number of categories (integer) α 1 , ⋯ , α K {displaystyle alpha _{1},cdots ,alpha _{K}} concentration parameters, where α i > 0 {displaystyle alpha _{i}>0} Support x 1 , ⋯ , x K {displaystyle x_{1},cdots ,x_{K}} where x i ∈ ( 0 , 1 ) {displaystyle x_{i}in (0,1)} and ∑ i = 1 K x i = 1 {displaystyle sum _{i=1}^{K}x_{i}=1} PDF 1 B ( α ) ∏ i = 1 K x i α i − 1 {displaystyle {rac {1}{mathrm {B} ({oldsymbol {alpha }})}}prod _{i=1}^{K}x_{i}^{alpha _{i}-1}} where B ( α ) = ∏ i = 1 K Γ ( α i ) Γ ( ∑ i = 1 K α i ) {displaystyle mathrm {B} ({oldsymbol {alpha }})={rac {prod _{i=1}^{K}Gamma (alpha _{i})}{Gamma {igl (}sum _{i=1}^{K}alpha _{i}{igr )}}}} where α = ( α 1 , … , α K ) {displaystyle {oldsymbol {alpha }}=(alpha _{1},ldots ,alpha _{K})} Mean E [ X i ] = α i ∑ k α k {displaystyle operatorname {E} [X_{i}]={rac {alpha _{i}}{sum _{k}alpha _{k}}}} E [ ln X i ] = ψ ( α i ) − ψ ( ∑ k α k ) {displaystyle operatorname {E} [ln X_{i}]=psi (alpha _{i})-psi ( extstyle sum _{k}alpha _{k})} (see digamma function) Mode x i = α i − 1 ∑ k = 1 K α k − K , α i > 1. {displaystyle x_{i}={rac {alpha _{i}-1}{sum _{k=1}^{K}alpha _{k}-K}},quad alpha _{i}>1.} Variance V a r [ X i ] = α i ( α 0 − α i ) α 0 2 ( α 0 + 1 ) , {displaystyle mathrm {Var} [X_{i}]={rac {alpha _{i}(alpha _{0}-alpha _{i})}{alpha _{0}^{2}(alpha _{0}+1)}},} where α 0 = ∑ i = 1 K α i {displaystyle alpha _{0}=sum _{i=1}^{K}alpha _{i}} C o v [ X i , X j ] = − α i α j α 0 2 ( α 0 + 1 ) ( i ≠ j ) {displaystyle mathrm {Cov} [X_{i},X_{j}]={rac {-alpha _{i}alpha _{j}}{alpha _{0}^{2}(alpha _{0}+1)}}~~(ieq j)} |
In probability and statistics, the Dirichlet distribution (after Peter Gustav Lejeune Dirichlet), often denoted
Contents
- Probability density function
- Support
- Special cases
- Moments
- Mode
- Marginal distributions
- Conjugate to categoricalmultinomial
- Relation to Dirichlet multinomial distribution
- Entropy
- Aggregation
- Neutrality
- Characteristic function
- Related distributions
- Conjugate prior of the Dirichlet distribution
- Applications
- Gamma distribution
- Marginal beta distributions
- The concentration parameter
- String cutting
- Plyas urn
- References
The infinite-dimensional generalization of the Dirichlet distribution is the Dirichlet process.

Probability density function
The Dirichlet distribution of order K ≥ 2 with parameters α1, ..., αK > 0 has a probability density function with respect to Lebesgue measure on the Euclidean space RK−1 given by
on the open (K − 1)-dimensional simplex defined by:
and zero elsewhere.
The normalizing constant is the multivariate Beta function, which can be expressed in terms of the gamma function:
Support
The support of the Dirichlet distribution is the set of K-dimensional vectors
Special cases
A common special case is the symmetric Dirichlet distribution, where all of the elements making up the parameter vector
When α=1[2], the symmetric Dirichlet distribution is equivalent to a uniform distribution over the open standard (K−1)-simplex, i.e. it is uniform over all points in its support. This particular distribution is known as the flat Dirichlet distribution. Values of the concentration parameter above 1 prefer variates that are dense, evenly distributed distributions, i.e. all the values within a single sample are similar to each other. Values of the concentration parameter below 1 prefer sparse distributions, i.e. most of the values within a single sample will be close to 0, and the vast majority of the mass will be concentrated in a few of the values.
More generally, the parameter vector is sometimes written as the product
Moments
Let
Let
Then
Furthermore, if
Note that the matrix so defined is singular.
More generally, moments of Dirichlet-distributed random variables can be expressed as
Mode
The mode of the distribution is the vector (x1, ..., xK) with
Marginal distributions
The marginal distributions are beta distributions:
Conjugate to categorical/multinomial
The Dirichlet distribution is the conjugate prior distribution of the categorical distribution (a generic discrete probability distribution with a given number of possible outcomes) and multinomial distribution (the distribution over observed counts of each possible category in a set of categorically distributed observations). This means that if a data point has either a categorical or multinomial distribution, and the prior distribution of the distribution's parameter (the vector of probabilities that generates the data point) is distributed as a Dirichlet, then the posterior distribution of the parameter is also a Dirichlet. Intuitively, in such a case, starting from what we know about the parameter prior to observing the data point, we then can update our knowledge based on the data point and end up with a new distribution of the same form as the old one. This means that we can successively update our knowledge of a parameter by incorporating new observations one at a time, without running into mathematical difficulties.
Formally, this can be expressed as follows. Given a model
then the following holds:
This relationship is used in Bayesian statistics to estimate the underlying parameter p of a categorical distribution given a collection of N samples. Intuitively, we can view the hyperprior vector α as pseudocounts, i.e. as representing the number of observations in each category that we have already seen. Then we simply add in the counts for all the new observations (the vector c) in order to derive the posterior distribution.
In Bayesian mixture models and other hierarchical Bayesian models with mixture components, Dirichlet distributions are commonly used as the prior distributions for the categorical variables appearing in the models. See the section on applications below for more information.
Relation to Dirichlet-multinomial distribution
In a model where a Dirichlet prior distribution is placed over a set of categorical-valued observations, the marginal joint distribution of the observations (i.e. the joint distribution of the observations, with the prior parameter marginalized out) is a Dirichlet-multinomial distribution. This distribution plays an important role in hierarchical Bayesian models, because when doing inference over such models using methods such as Gibbs sampling or variational Bayes, Dirichlet prior distributions are often marginalized out. See the article on this distribution for more details.
Entropy
If X is a Dir(α) random variable, then the exponential family differential identities can be used to get an analytic expression for the expectation of
and
where
The spectrum of Rényi information for values other than
and the information entropy is the limit as
Aggregation
If
then, if the random variables with subscripts i and j are dropped from the vector and replaced by their sum,
This aggregation property may be used to derive the marginal distribution of
Neutrality
If
and similarly for removing any of
Characteristic function
The characteristic function of the Dirichlet distribution is a confluent form of the Lauricella hypergeometric series. It is given by Phillips as
where
The sum is over non-negative integers
where L denotes any path in the complex plane originating at
Related distributions
For K independently distributed Gamma distributions:
we have:
Although the Xis are not independent from one another, they can be seen to be generated from a set of K independent gamma random variable. Unfortunately, since the sum V is lost in forming X (in fact it can be shown that V is stochastically independent of X), it is not possible to recover the original gamma random variables from these values alone. Nevertheless, because independent random variables are simpler to work with, this reparametrization can still be useful for proofs about properties of the Dirichlet distribution.
Conjugate prior of the Dirichlet distribution
Because the Dirichlet distribution is an exponential family distribution it has a conjugate prior. The conjugate prior is of the form:
Here
Given a single observed Dirichlet observation
In the published literature there is no practical algorithm to efficiently generate samples from
Applications
Dirichlet distributions are most commonly used as the prior distribution of categorical variables or multinomial variables in Bayesian mixture models and other hierarchical Bayesian models. (Note that in many fields, such as in natural language processing, categorical variables are often imprecisely called "multinomial variables". Such a usage is liable to cause confusion, just as if Bernoulli distributions and binomial distributions were commonly conflated.)
Inference over hierarchical Bayesian models is often done using Gibbs sampling, and in such a case, instances of the Dirichlet distribution are typically marginalized out of the model by integrating out the Dirichlet random variable. This causes the various categorical variables drawn from the same Dirichlet random variable to become correlated, and the joint distribution over them assumes a Dirichlet-multinomial distribution, conditioned on the hyperparameters of the Dirichlet distribution (the concentration parameters). One of the reasons for doing this is that Gibbs sampling of the Dirichlet-multinomial distribution is extremely easy; see that article for more information.
Gamma distribution
With a source of Gamma-distributed random variates, one can easily sample a random vector
and then set
Below is example Python code to draw the sample:
This formulation is correct regardless of how the Gamma distributions are parameterized (shape/scale vs. shape/rate) because they are equivalent when scale and rate equal 1.0.
Marginal beta distributions
A less efficient algorithm relies on the univariate marginal and conditional distributions being beta and proceeds as follows. Simulate
Then simulate
and let
Finally, set
This iterative procedure corresponds closely to the "string cutting" intuition described below.
Below is example Python code to draw the sample:
The concentration parameter
Dirichlet distributions are very often used as prior distributions in Bayesian inference. The simplest and perhaps most common type of Dirichlet prior is the symmetric Dirichlet distribution, where all parameters are equal. This corresponds to the case where you have no prior information to favor one component over any other. As described above, the single value α to which all parameters are set is called the concentration parameter. If the sample space of the Dirichlet distribution is interpreted as a discrete probability distribution, then intuitively the concentration parameter can be thought of as determining how "concentrated" the probability mass of a sample from a Dirichlet distribution is likely to be. With a value much less than 1, the mass will be highly concentrated in a few components, and all the rest will have almost no mass. With a value much greater than 1, the mass will be dispersed almost equally among all the components. See the article on the concentration parameter for further discussion.
String cutting
One example use of the Dirichlet distribution is if one wanted to cut strings (each of initial length 1.0) into K pieces with different lengths, where each piece had a designated average length, but allowing some variation in the relative sizes of the pieces. The α/α0 values specify the mean lengths of the cut pieces of string resulting from the distribution. The variance around this mean varies inversely with α0.
Pólya's urn
Consider an urn containing balls of K different colors. Initially, the urn contains α1 balls of color 1, α2 balls of color 2, and so on. Now perform N draws from the urn, where after each draw, the ball is placed back into the urn with an additional ball of the same color. In the limit as N approaches infinity, the proportions of different colored balls in the urn will be distributed as Dir(α1,...,αK).
For a formal proof, note that the proportions of the different colored balls form a bounded [0,1]K-valued martingale, hence by the martingale convergence theorem, these proportions converge almost surely and in mean to a limiting random vector. To see that this limiting vector has the above Dirichlet distribution, check that all mixed moments agree.
Note that each draw from the urn modifies the probability of drawing a ball of any one color from the urn in the future. This modification diminishes with the number of draws, since the relative effect of adding a new ball to the urn diminishes as the urn accumulates increasing numbers of balls. This "diminishing returns" effect can also help explain how small (edit: large I think) α values yield Dirichlet distributions with most of the probability mass concentrated around a single point on the simplex.