Compute the probability density function for a multinomial
The multinomial distribution is a multivariate generalization
of the binomial distribution. For a binomial distribution,
we perform >n trials where each trial has two mutually
exclusive outcomes (labeled success and failure). Each trial
has the same probability of success, p. The binomial
distribution is the probability of x successes in the
The multinomial distribution extends this by allowing k
possible outcomes. These outcomes are mutually exclusive
with each outcome having probability pi The
pi must sum to 1 and are the same for each
trial. The multinomial distribution is the probability that
each event occurs xi
times (i = 1, 2, ..., k) in the n trials.
The probability mass function for the multinomial distribution
is defined as
where x1 ..., xk are
non-negative integers that sum to the number of trials
and the pi denote the
probabilities of outcome i. The pi
should all be in the interval (0,1) and sum to 1.
LET <a> = MULTINOMIAL PDF <x> <p>
where <x> is a non-negative variable specifying the
number of times the corresponding outcome occurs;
<p> is a variable (of the same length as <x>)
containing the desired probabilities for each
and where <a> is a parameter where the resulting
multinomial pdf is stored.
LET P = DATA 0.2 0.1 0.3 0.2 0.2
LET X = DATA 5 4 10 8 7
LET A = MULTINOMIAL PDF X P
Dataplot uses a Fortran translation of the
"gsl_ran_multinomial_lnpdf" code (written by Gavin Crooks)
from the GNU GSL library.
MULTINOMIAL RANDOM NUMBERS
= Generate multinomial random numbers.
= Compute the binomial pdf function.
= Compute the Dirichelet pdf function.
"Statistical Distributions: Third Edition", Evans, Hastings,
and Peacock, Wiley, 2000, pp. 134-136.
Simulation, Bayesian Analysis
let p = data 0.2 0.1 0.2 0.3 0.2
let x = data 12 5 8 10 6
let a = multinomial pdf x p
The computed value of a is 0.0002189.
Date created: 7/7/2004
Last updated: 7/7/2004
Please email comments on this WWW page to