ASA266
Estimating the Parameters of a Dirichlet PDF
ASA266
is a MATLAB library which
estimates the parameters of a Dirichlet probability density function.
ASA266 is Applied Statistics Algorithm 266. Source code for many
Applied Statistics Algorithms is available through
STATLIB.
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 the underlying parameters ALPHA 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.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
ASA266 is available in
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
ASA032,
a MATLAB library which
evaluates the incomplete Gamma integral.
ASA066,
a MATLAB library which
evaluates the percentage points of the normal distribution.
ASA091,
a MATLAB library which
evaluates the percentage points of the Chi-Squared distribution.
ASA103,
a MATLAB library which
evaluates the digamma or psi function.
ASA111,
a MATLAB library which
evaluates the percentage points of the normal distribution.
ASA121,
a MATLAB library which
evaluates the trigamma function.
ASA147,
a MATLAB library which
evaluates the incomplete Gamma function.
ASA239,
a MATLAB library which
evaluates the percentage points of the Chi-Squared distribution
and the incomplete Gamma function.
ASA241,
a MATLAB library which
evaluates the percentage points of the normal distribution.
ASA245,
a MATLAB library which
evaluates the logarithm of the Gamma function.
NORMAL,
a MATLAB library which
samples the normal distribution.
PROB,
a MATLAB library which
evaluates the PDF, CDF, mean and variance for a number of probability
density functions.
TEST_VALUES,
a MATLAB library which
contains sample values
for a number of distributions.
TOMS291,
a MATLAB library which
evaluates the logarithm of the Gamma function.
UNIFORM,
a MATLAB library which
samples the uniform distribution.
Reference:
-
AG Adams,
Algorithm 39:
Areas Under the Normal Curve,
Computer Journal,
Volume 12, Number 2, May 1969, pages 197-198.
-
Joachim Ahrens, Ulrich Dieter,
Computer Methods for Sampling from Gamma, Beta, Poisson and
Binomial Distributions,
Computing,
Volume 12, Number 3, September 1974, pages 223-246.
-
Joachim Ahrens, Ulrich Dieter,
Generating Gamma Variates by a Modified Rejection Technique,
Communications of the ACM,
Volume 25, Number 1, January 1982, pages 47-54.
-
Jerry Banks, editor,
Handbook of Simulation,
Wiley, 1998,
ISBN: 0471134031,
LC: T57.62.H37.
-
JD Beasley, SG Springer,
Algorithm AS 111:
The Percentage Points of the Normal Distribution,
Applied Statistics,
Volume 26, Number 1, 1977, pages 118-121.
-
Jose Bernardo,
Algorithm AS 103:
Psi ( Digamma ) Function,
Applied Statistics,
Volume 25, Number 3, 1976, pages 315-317.
-
Donald Best, DE Roberts,
Algorithm AS 91:
The Percentage Points of the Chi-Squared Distribution,
Applied Statistics,
Volume 24, Number 3, 1975, pages 385-390.
-
G Bhattacharjee,
Algorithm AS 32:
The Incomplete Gamma Integral,
Applied Statistics,
Volume 19, Number 3, 1970, pages 285-287.
-
William Cody, Kenneth Hillstrom,
Chebyshev Approximations for the Natural Logarithm of the
Gamma Function,
Mathematics of Computation,
Volume 21, Number 98, April 1967, pages 198-203.
-
William Cody, Anthony Strecok, Henry Thacher,
Chebyshev Approximations for the Psi Function,
Mathematics of Computation,
Volume 27, Number 121, January 1973, pages 123-127.
-
John Hart, Ward Cheney, Charles Lawson, Hans Maehly,
Charles Mesztenyi, John Rice, Henry Thacher,
Christoph Witzgall,
Computer Approximations,
Wiley, 1968,
LC: QA297.C64.
-
David Hill,
Algorithm AS 66:
The Normal Integral,
Applied Statistics,
Volume 22, Number 3, 1973, pages 424-427.
-
Cornelius Lanczos,
A precision approximation of the gamma function,
SIAM Journal on Numerical Analysis, B,
Volume 1, 1964, pages 86-96.
-
Chi Leung Lau,
Algorithm AS 147:
A Simple Series for the Incomplete Gamma Integral,
Applied Statistics,
Volume 29, Number 1, 1980, pages 113-114.
-
Allan Mcleod,
Algorithm AS 245:
A Robust and Reliable Algorithm for the Logarithm
of the Gamma Function,
Applied Statistics,
Volume 38, Number 2, 1989, pages 397-402.
-
A. Naryanan,
Algorithm AS 266:
Maximum Likelihood Estimation of the Parameters of the
Dirichlet Distribution,
Applied Statistics,
Volume 40, Number 2, 1991, pages 365-374.
-
Malcolm Pike, David Hill,
Algorithm 291:
Logarithm of Gamma Function,
Communications of the ACM,
Volume 9, Number 9, September 1966, page 684.
-
BE Schneider,
Algorithm AS 121:
Trigamma Function,
Applied Statistics,
Volume 27, Number 1, 1978, pages 97-99.
-
BL Shea,
Algorithm AS 239:
Chi-squared and Incomplete Gamma Integral,
Applied Statistics,
Volume 37, Number 3, 1988, pages 466-473.
-
Michael Wichura,
Algorithm AS 241:
The Percentage Points of the Normal Distribution,
Applied Statistics,
Volume 37, Number 3, 1988, pages 477-484.
Source Code:
-
alngam.m,
computes the logarithm of the gamma function;
-
alnorm.m,
computes the cumulative density of the standard normal distribution.;
-
alogam.m,
computes the logarithm of the Gamma function;
-
digamma.m,
calculates DIGAMMA ( X ) = d ( LOG ( GAMMA ( X ) ) ) / dX;
-
dirichlet_check.m,
checks the parameters of the Dirichlet PDF;
-
dirichlet.m,
estimates the parameters of a Dirichlet distribution;
-
dirichlet_mean.m,
returns the means of the Dirichlet PDF;
-
dirichlet_mix_mean.m,
returns the means of a Dirichlet mixture PDF;
-
dirichlet_mix_sample.m,
samples a Dirichlet mixture PDF;
-
dirichlet_sample.m,
samples the Dirichlet PDF;
-
dirichlet_variance.m,
returns the variances of the Dirichlet PDF;
-
exponential_01_sample.m,
samples the Exponential PDF with parameter 1;
-
exponential_cdf_inv.m,
inverts the Exponential CDF;
-
gamain.m,
computes the incomplete gamma ratio;
-
gamma_sample.m,
samples the gamma PDF;
-
gammad.m,
computes the Incomplete Gamma Integral;
-
gammds.m,
computes the incomplete Gamma integral;
-
lngamma.m,
computes Log(Gamma(X)) using a Lanczos approximation;
-
normal_01_sample.m,
samples the standard normal PDF;
-
normp.m,
computes the CDF of the standard normal distribution;
-
nprob.m,
computes the CDF of the standard normal distribution;
-
ppchi2.m,
evaluates the percentage points of the Chi-squared PDF;
-
ppnd.m,
produces the normal deviate value corresponding to lower tail area = P;
-
r4_normal_01_cdf_inverse.m,
inverts the standard normal CDF;
-
r4poly_val_horner.m,
evaluates a polynomial in standard form.;
-
r8_gamma_log.m,
calculates Log(Gamma(X));
-
r8_normal_01_cdf_inverse.m,
inverts the standard normal CDF;
-
r8_psi.m,
evaluates the function Psi(X);
-
r8_uniform_01.m,
returns a unit pseudorandom R8;
-
r8col_mean.m,
returns the column means of an R8COL;
-
r8col_variance.m,
returns the column variances of an R8COL;
-
r8poly_val_horner.m,
evaluates a polynomial in standard form.;
-
r8vec_unit_sum.m,
normalizes an R8VEC to have unit norm;
-
timestamp.m,
returns the current YMDHMS date as a timestamp;
-
trigamma.m,
calculates trigamma(x) = d**2 log(gamma(x)) / dx**2;
Examples and Tests:
-
asa266_test.m,
calls all the tests.
-
asa266_test_output.txt,
the output file.
-
asa266_test01.m,
tests ALNORM, NORMP, NPROB.
-
asa266_test02.m,
tests PPND, R4_NORMAL_01_CDF_INVERSE, R8_NORMAL_01_CDF_INVERSE.
-
asa266_test03.m,
tests DIGAMMA, R8_PSI.
-
asa266_test04.m,
tests TRIGAMMA.
-
asa266_test05.m,
tests ALNGAM, ALOGAM, R8_GAMMA_LOG, LNGAMMA;
-
asa266_test06.m,
tests GAMAIN, GAMMDS, GAMMAD.
-
asa266_test07.m,
tests PPCHI2.
-
asa266_test08.m,
tests DIRICHLET_ESTIMATE, DIRICHLET_MEAN, DIRICHLET_VARIANCE.
-
asa266_test09.m,
tests DIRICHLET_ESTIMATE, DIRICHLET_MEAN, DIRICHLET_VARIANCE, DIRICHLET_SAMPLE.
-
asa266_test10.m,
tests DIRICHLET_MIX_SAMPLE, DIRICHLET_MIX_MEAN, DIRICHLET_MIX_VARIANCE.
You can go up one level to
the MATLAB source codes.
Last revised on 04 August 2010.