pmultinom
is a library for calculating multinomial probabilities. The probabilities that can be calculated include the multinomial cumulative distribution function:
P(N1 ≤ u1, N2 ≤ u2, ⋯, Nk ≤ uk)
In this case the usage would be
pmultinom(upper=us, size=n, probs=ps, method="exact")
where us
is the vector containing u1, u2, ⋯, uk, and n
and ps
are the parameters of the multinomial distribution. This usage is analogous to the use of pbinom
. Another important case is the probability of seeing more than some minimum number of observations in each category:
P(N1 > l1, N2 > l2, ⋯, Nk > lk)
In this case the usage would be
pmultinom(lower=ls, size=n, probs=ps, method="exact")
where this time ls
is the vector containing l1, l2, ⋯, lk. Notice that in this case these are greater than signs, not greater than or equal signs. This is analogous to the usage of pbinom
with lower.tail=FALSE
. With some creativity, these can be adapted to calculate the probability that the maximum or minimum of a multinomial random vector is a given number, or that a given category will be the most or least observed. pmultinom
also supports a more general usage, in which both lower and upper bounds are specified:
P(l1 < N1 ≤ u1, l2 < N2 ≤ u2, ⋯, lk < Nk ≤ uk)
In this case the usage would be
pmultinom(lower=ls, upper=us, size=n, probs=ps, method="exact")
See vignette("pmultinom")
for the above text in Latex plus an example application. Many thanks to Aislyn Schalck for advice and encouragement.