Dirichlet distribution
| Probability density function |
|
| Parameters | number of categories (integer) concentration parameters, where ![]() |
|---|---|
| Support | where and ![]() |
![]() where ![]() where ![]() |
|
| Mean | ![]() ![]() (see digamma function) |
| Mode | ![]() |
| Variance | ![]() where ![]() ![]() |
| Entropy | see text |
In probability and statistics, the Dirichlet distribution (after Peter Gustav Lejeune Dirichlet), often denoted
, is a family of continuous multivariate probability distributions parametrized by a vector
of positive reals. It is the multivariate generalization of the beta distribution.[1] Dirichlet distributions are very often used as prior distributions in Bayesian statistics, and in fact the Dirichlet distribution is the conjugate prior of the categorical distribution and multinomial distribution. That is, its probability density function returns the belief that the probabilities of K rival events are
given that each event has been observed
times.
The infinite-dimensional generalization of the Dirichlet distribution is the Dirichlet process.
Contents |
Probability density function [edit]
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
for all x1, ..., xK–1 > 0 satisfying x1 + ... + xK–1 < 1, and where xK = 1 – x1 – ... – xK–1. The density is zero outside this open (K − 1)-dimensional simplex.
The normalizing constant is the multinomial Beta function, which can be expressed in terms of the gamma function:
Support [edit]
The support of the Dirichlet distribution is the set of
-dimensional vectors
whose entries are real numbers in the interval
; furthermore,
, i.e. the sum of the coordinates is 1. These can be viewed as the probabilities of a K-way categorical event. Another way to express this is that the domain of the Dirichlet distribution is itself a probability distribution, specifically a
-dimensional discrete distribution. Note that the technical term for the set of points in the support of a
-dimensional Dirichlet distribution is the open standard
-simplex, which is a generalization of a triangle, embedded in the next-higher dimension. For example, with
, the support looks like an equilateral triangle embedded in a downward-angle fashion in three-dimensional space, with vertices at
and
, i.e. touching each of the coordinate axes at a point 1 unit away from the origin.
Special cases [edit]
A very common special case is the symmetric Dirichlet distribution, where all of the elements making up the parameter vector
have the same value. Symmetric Dirichlet distributions are often used when a Dirichlet prior is called for, since there typically is no prior knowledge favoring one component over another. Since all elements of the parameter vector have the same value, the distribution alternatively can be parametrized by a single scalar value
, called the concentration parameter[citation needed]. The density function then simplifies to
When
[1], the symmetric Dirichlet distribution is equivalent to a uniform distribution over the open standard
-simplex, i.e. it is uniform over all points in its support. 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, parameter vector is sometimes written as the product
of a (scalar) concentration parameter
and a (vector) base measure
where
lies within the K-1 simplex (i.e.: its coordinates
sum to one). The concentration parameter in this case is larger by a factor of K than the concentration parameter for a symmetric Dirichlet distribution described above. This construction ties in with concept of a base measure when discussing Dirichlet processes and is often used in the topic modelling literature.
- ^ If we define the concentration parameter as the sum of the Dirichlet parameters for each dimension, the Dirichlet distribution is uniform with a concentration parameter is K, the dimension of the distribution.
Properties [edit]
Moments [edit]
Let
, meaning that the first K – 1 components have the above density and
Furthermore, if 
(Note that the matrix so defined is singular.).
Mode [edit]
The mode of the distribution is[citation needed] the vector (x1, ..., xK) with
Marginal distributions [edit]
The marginal distributions are beta distributions:[4]
Conjugate to categorical/multinomial [edit]
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 data point'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 [edit]
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 [edit]
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 its associated covariance matrix:[citation needed]
and
where
is the digamma function,
is the trigamma function, and
is the Kronecker delta. The formula for
yields the following formula for the information entropy of X:[citation needed]
Aggregation [edit]
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
mentioned above.
Neutrality [edit]
If
, then the vector
is said to be neutral[5] in the sense that
is independent of
[6] where
and similarly for removing any of
. Observe that any permutation of
is also neutral (a property not possessed by samples drawn from a generalized Dirichlet distribution.)[7]
Related distributions [edit]
If, for 
then [8]
and
Although the Xis are not independent from one another, they can be seen to be generated from a set of
independent gamma random variables (see [9] for proof). Unfortunately, since the sum
is lost in forming 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.
Applications [edit]
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.
Random number generation [edit]
Gamma distribution [edit]
With a source of Gamma-distributed random variates, one can easily sample a random vector
from the K-dimensional Dirichlet distribution with parameters
. First, draw K independent random samples
from Gamma distributions each with density
and then set
Below is example python code to draw the sample:
params = [a1, a2, ..., ak] sample = [random.gammavariate(a,1) for a in params] sample = [v/sum(sample) for v in sample]
Marginal beta distributions [edit]
A less efficient algorithm[10] relies on the univariate marginal and conditional distributions being beta and proceeds as follows. Simulate
from a
distribution. Then simulate
in order, as follows. For
, simulate
from a
distribution, and let
. Finally, set
.
Below is example python code to draw the sample:
params = [a1, a2, ..., ak] xs = [random.betavariate(params[0], sum(params[1:]))] for j in range(1,len(params)-1): phi = random.betavariate(params[j], sum(params[j+1:])) xs.append((1-sum(xs)) * phi) xs.append(1-sum(xs))
Intuitive interpretations of the parameters [edit]
The concentration parameter [edit]
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 [edit]
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 [edit]
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).[11]
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 α values yield Dirichlet distributions with most of the probability mass concentrated around a single point on the simplex.
See also [edit]
References [edit]
- ^ S. Kotz, N. Balakrishnan, and N. L. Johnson (2000). Continuous Multivariate Distributions. Volume 1: Models and Applications. New York: Wiley. ISBN 0-471-18387-3. (Chapter 49: Dirichlet and Inverted Dirichlet Distributions)
- ^ Eq. (49.9) on page 488 of Kotz, Balakrishnan & Johnson (2000). Continuous Multivariate Distributions. Volume 1: Models and Applications. New York: Wiley.
- ^ BalakrishV. B. (2005). ""Chapter 27. Dirichlet Distribution"". A Primer on Statistical Distributions. Hoboken, NJ: John Wiley & Sons, Inc. p. 274. ISBN 978-0-471-42798-8.
- ^ Farrow, Malcolm. "MAS3301 Bayesian Statistics". Newcastle University. Newcastle University. Retrieved 10 April 2013.
- ^ Connor, Robert J.; Mosimann, James E (1969). "Concepts of Independence for Proportions with a Generalization of the Dirichlet Distribution". Journal of the American Statistical Association (American Statistical Association) 64 (325): 194–206. doi:10.2307/2283728. JSTOR 2283728.
- ^ Bela A. Frigyik, Amol Kapila, and Maya R. Gupta (2010). "Introduction to the Dirichlet Distribution and Related Processes" (Technical Report UWEETR-2010-006). University of Washington Department of Electrical Engineering. Retrieved May 2012.
- ^ See Kotz, Balakrishnan & Johnson (2000), Section 8.5, "Connor and Mosimann's Generalization", pp. 519–521.
- ^ Devroye, Luc (1986). Non-Uniform Random Variate Generation. Springer-Verlag. p. 402.
- ^ Devroye, Luc (1986). Non-Uniform Random Variate Generation. Springer-Verlag. p. 594. (Chapter 11.)
- ^ A. Gelman and J. B. Carlin and H. S. Stern and D. B. Rubin (2003). Bayesian Data Analysis (2nd ed.). p. 582. ISBN 1-58488-388-X.
- ^ Blackwell, David; MacQueen, James B. (1973). "Ferguson distributions via Polya urn schemes". Ann. Stat. 1 (2): 353–355. doi:10.1214/aos/1176342372.
External links [edit]
- Hazewinkel, Michiel, ed. (2001), "Dirichlet distribution", Encyclopedia of Mathematics, Springer, ISBN 978-1-55608-010-4
- Dirichlet Distribution
- How to estimate the parameters of the Dirichlet distribution using expectation-maximization (EM)
- Luc Devroye. "Non-Uniform Random Variate Generation". Retrieved May 2012.
- Dirichlet Random Measures, Method of Construction via Compound Poisson Random Variables, and Exchangeability Properties of the resulting Gamma Distribution
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
number of categories (

where
and 



![\operatorname{E}[X_i] = \frac{\alpha_i}{\sum_k \alpha_k}](http://upload.wikimedia.org/math/2/5/9/259a63cb3efc1d3d5978b06293d97796.png)
![\operatorname{E}[\ln X_i] = \psi(\alpha_i)-\psi(\textstyle\sum_k \alpha_k)](http://upload.wikimedia.org/math/c/d/a/cdac7a917e09a9fe3679681bc9ccf181.png)

![\mathrm{Var}[X_i] = \frac{\alpha_i (\alpha_0-\alpha_i)}{\alpha_0^2 (\alpha_0+1)},](http://upload.wikimedia.org/math/1/1/f/11f1756341eabbbac8585d2c0f0341b9.png)

![\mathrm{Cov}[X_i,X_j] = \frac{- \alpha_i \alpha_j}{\alpha_0^2 (\alpha_0+1)}~~(i\neq j)](http://upload.wikimedia.org/math/5/5/8/5587fe6d0dc92ed21abf68988d743c9d.png)
's equal to each other.



. Then![\mathrm{E}[X_i] = \frac{\alpha_i}{\alpha_0},](http://upload.wikimedia.org/math/7/6/9/76941af82bb219bd4ecf15bd866df3e7.png)
![\mathrm{Var}[X_i] = \frac{\alpha_i (\alpha_0-\alpha_i)}{\alpha_0^2 (\alpha_0+1)}.](http://upload.wikimedia.org/math/3/3/7/3376d062dda46cb0f0a45d24816de873.png)
![\mathrm{Cov}[X_i,X_j] = \frac{- \alpha_i \alpha_j}{\alpha_0^2 (\alpha_0+1)}.](http://upload.wikimedia.org/math/b/a/9/ba9e62f8f5cedd033827513a27a55be5.png)




![\operatorname{E}[\log(X_i)] = \psi(\alpha_i)-\psi(\alpha_0)](http://upload.wikimedia.org/math/5/6/3/563076baa91def0b7066694f678e5f4b.png)
![\operatorname{Cov}[\log(X_i),\log(X_j)] = \psi'(\alpha_i) \delta_{ij} - \psi'(\alpha_0)](http://upload.wikimedia.org/math/0/6/8/068dd2df102484a265d4afdbc1e553ac.png)








