The Dirichlet distribution is a family of continuous multivariate probability distributions
parameterized by a vector \(\alpha\) of positive reals. It is the multivariate
generalization of the beta distribution and is commonly used as a conjugate prior
to the multinomial distribution in Bayesian statistics.
Probability Density Function:
For a vector \(x = (x_1, \dots, x_K)\) on the unit simplex (where \(\sum x_i = 1\)
and \(x_i \ge 0\)), the density is given by:
$$f(x_1, \dots, x_K; \alpha_1, \dots, \alpha_K) = \frac{1}{B(\alpha)} \prod_{i=1}^{K} x_i^{\alpha_i - 1}$$
where the normalizing constant \(B(\alpha)\) is the multivariate beta function:
$$B(\alpha) = \frac{\prod_{i=1}^{K} \Gamma(\alpha_i)}{\Gamma(\sum_{i=1}^{K} \alpha_i)}$$
Simulation Method:
The function utilizes the property that if \(Y_1, \dots, Y_K\) are independent
Gamma random variables such that \(Y_i \sim Gamma(shape = \alpha_i, rate = 1)\), then:
$$X_i = \frac{Y_i}{\sum_{j=1}^{K} Y_j}$$
The resulting vector \((X_1, \dots, X_K)\) follows a Dirichlet distribution with parameters \(\alpha\).