# DIRICHLET - Estimating Dirichlet Parameters

DIRICHLET is essentially a life-support system for the DIRICH routine. DIRICH, in turn, is Applied Statistics Algorithm 266, for estimating the parameters of a Dirichlet distribution.

The assumption is that a given process is governed by a Dirichlet distribution with parameters ALPHA(I), I = 1 to N, positive quantities which are required to sum to 1. Each observation of the process yields a vector of N data values. After a number of observations of this sort, it is desired to estimate the values of the underlying parameters of the Dirichlet distribution.

There are a considerable number of routines required to get DIRICH to work. In some cases, there are several versions of the routines, and they all were included, in order to provide a way to check results. Most of the routines are themselves Applied Statistics Algorithms, and their source code is available through STATLIB.

Also included is a routine DIRICHLET_SAMPLE, with which experiments can be carried out. Values for the parameters ALPHA can be chosen, and data generated by DIRICHLET_SAMPLE. Then DIRICH can analyze this data and attempt to determine the values of ALPHA.

Another routine, DIRICHLET_MIX_SAMPLE, allows you to sample a probability distribution that is a weighted mixture of Dirichlet distributions.

Files you may copy include:

The list of routines includes:

• ALNGAM computes the logarithm of the Gamma function.
• ALNORM computes the cumulative density of the standard normal distribution.
• ALOGAM computes the logarithm of the Gamma function.
• DIGAMA calculates DIGAMMA ( X ) = d ( LOG ( GAMMA ( X ) ) ) / dX
• DIRICH estimates the parameters of a Dirichlet distribution.
• DIRICHLET_MEAN returns the means of the Dirichlet PDF.
• DIRICHLET_MIX_MEAN returns the means of a Dirichlet mixture PDF.
• DIRICHLET_MIX_SAMPLE samples a Dirichlet mixture PDF.
• DIRICHLET_SAMPLE samples the Dirichlet PDF.
• EXPONENTIAL_1_SAMPLE samples the Exponential PDF with parameter 1.
• EXPONENTIAL_CDF_INV inverts the Exponential CDF.
• GAMAIN computes the incomplete Gamma ratio.
• GAMLOG computes the logarithm of the Gamma function of X.
• GAMMA_SAMPLE samples the Gamma PDF.
• GAMMAD computes the Incomplete Gamma Integral
• GAMMDS computes the incomplete Gamma integral.
• LNGAMMA computes Log(Gamma(X)) using a Lanczos approximation.
• LOG_GAMMA calculates the natural logarithm of GAMMA ( X ) for positive X.
• NORMAL_01_SAMPLE samples the standard Normal PDF.
• NORMP computes the cumulative density of the standard normal distribution.
• NPROB computes the cumulative density of the standard normal distribution.
• PPCHI2 evaluates the percentage points of the chi-squared PDF.
• PPND produces the normal deviate value corresponding to lower tail area = P.
• PPND16 produces the normal deviate value corresponding to lower tail area = P.
• PPND7 produces the normal deviate value corresponding to lower tail area = P.
• R_RANDOM returns a random real in a given range.
• RCOL_MEAN returns the means of columns of a real array.
• RVEC_SUM sums the entries of a real vector.
• TRIGAM calculates trigamma(x) = d**2 log(Gamma(x)) / dx**2