bdmlib, a FORTRAN90 code which estimates the weights W in a Dirichlet mixture PDF (probability density function) by analyzing events that were generated by the mixture.

To generate "events", first one of the component Dirichlet PDF's is chosen based on the weights W. Then the Dirichlet PDF, whose parameters ALPHA are known, is used to generate a probability vector P. This probability vector is then used with the multinomial PDF to generate an integer vector X, which is the result.

Now, we assume that we are watching this process, and have no knowledge of the weights W. Simply by observing the result vectors X, we will try to estimate the values of the W's. A pseudo-Bayesian process is used to do this.


The computer code and data files made available on this web page are distributed under the MIT license


bdmlib is available in a FORTRAN90 version.

Related Data and Programs:

ASA266, a FORTRAN90 code which evaluates various properties of a Dirichlet distribution.


GETWGT, a FORTRAN90 code which estimates the parameters of a Dirichlet mixture.


  1. Joachim Ahrens, Ulrich Dieter,
    Computer Methods for Sampling From the Exponential and Normal Distributions,
    Communications of the ACM,
    Volume 15, Number 10, October 1972, pages 873-882.
  2. 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.
  3. Joachim Ahrens, Klaus-Dieter Kohrt, Ulrich Dieter,
    Algorithm 599: Sampling from Gamma and Poisson Distributions,
    ACM Transactions on Mathematical Software,
    Volume 9, Number 2, June 1983, pages 255-257.
  4. Jerry Banks, editor,
    Handbook of Simulation,
    Wiley, 1998,
    ISBN: 0471134031,
    LC: T57.62.H37.
  5. Carl Branden, John Tooze,
    Introduction to Protein Structure,
    Second Edition,
    Garland Publishing, 1999,
    ISBN: 0815323050,
    LC: QP551.B7635.
  6. 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.
  7. Luc Devroye,
    Non-Uniform Random Variate Generation,
    Springer, 1986,
    ISBN: 0387963057,
    LC: QA274.D48.
  8. Brian Everitt, David Hand,
    Finite Mixture Distributions,
    Chapman and Hall, 1981.
  9. John Hart, Ward Cheney, Charles Lawson, Hans Maehly, Charles Mesztenyi, John Rice, Henry Thacher, Christoph Witzgall,
    Computer Approximations,
    Wiley, 1968,
    LC: QA297.C64.
  10. William Kennedy, James Gentle,
    Statistical Computing,
    Marcel Dekker, 1980,
    ISBN: 0824768981,
    LC: QA276.4.K46.
  11. Kenneth Lange,
    Mathematical and Statistical Methods for Genetic Analysis,
    Springer, 1997,
    ISBN: 0387953892,
    LC: QH438.4.M33.L36.
  12. AFM Smith, Udi Makov,
    A Quasi-Bayes Sequential Procedure for Mixtures,
    Journal of the Royal Statistical Society,
    Volume 40, Number 1, B, 1978, pages 106-112.

Source Code:

Last revised on 02 September 2021.