## File: The-Dirichlet-Distribution.html

package info (click to toggle)
gsl-ref-html 2.3-1
• area: non-free
• in suites: bullseye, buster, sid
• size: 6,876 kB
• ctags: 4,574
• sloc: makefile: 35
 file content (118 lines) | stat: -rw-r--r-- 5,974 bytes parent folder | download
 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118  GNU Scientific Library – Reference Manual: The Dirichlet Distribution

20.28 The Dirichlet Distribution

Function: void gsl_ran_dirichlet (const gsl_rng * r, size_t K, const double alpha[], double theta[])

This function returns an array of K random variates from a Dirichlet distribution of order K-1. The distribution function is

p(\theta_1, ..., \theta_K) d\theta_1 ... d\theta_K =    (1/Z) \prod_{i=1}^K \theta_i^{\alpha_i - 1} \delta(1 -\sum_{i=1}^K \theta_i) d\theta_1 ... d\theta_K

for theta_i >= 0 and alpha_i > 0. The delta function ensures that \sum \theta_i = 1. The normalization factor Z is

Z = {\prod_{i=1}^K \Gamma(\alpha_i)} / {\Gamma( \sum_{i=1}^K \alpha_i)}

The random variates are generated by sampling K values from gamma distributions with parameters a=alpha_i, b=1, and renormalizing. See A.M. Law, W.D. Kelton, Simulation Modeling and Analysis (1991).

Function: double gsl_ran_dirichlet_pdf (size_t K, const double alpha[], const double theta[])

This function computes the probability density p(\theta_1, ... , \theta_K) at theta[K] for a Dirichlet distribution with parameters alpha[K], using the formula given above.

Function: double gsl_ran_dirichlet_lnpdf (size_t K, const double alpha[], const double theta[])

This function computes the logarithm of the probability density p(\theta_1, ... , \theta_K) for a Dirichlet distribution with parameters alpha[K].