Loading [MathJax]/jax/output/HTML-CSS/jax.js

Wednesday, April 29, 2009

Sampling Dirichlet Distributions

[I just realized that this post from last year was only half the story.  See this post about using the gamma distribution directly to sample Dirchlet distributions]

I just commented on a post by Andrew Gelman about methods for sampling Dirichlet distributions. Those comments were pretty non specific and deserve a bit of amplification.

First off, a Dirichlet distribution is a distribution of real-valued tuples,
(x1xn)Dir(π1πn)
such that xi1 and ixi=1

The parameters πi are all non-negative.

The original question had to do with sampling the Dirichlet parameters, especially from a conjugate distribution. The one and true answer in mathematical terms is that there is, indeed, a continuous distribution which is the conjugate of a Dirichlet. In practical terms, however, that isn't the answer that you really want.

A much more practical answer is that the Dirichlet can be sampled from a prior that is characterized by n+1 non-negative real parameters using the following procedure
(m1mn)Dir(β1βn)αexp(β0)πiαmi
Alternative distributions for α include the gamma distribution and exponential normal, such as
logαN(0,2)