pmultinom: pmultinom

Description Usage Arguments Value Author(s) See Also Examples

View source: R/pmultinom.R

Description

Multinomial CDF

i.e. If n balls are thrown into k bins, calculate P(x1<=q1, x2<=q2, ..., xk<=qk) where xi are numbers of balls in each bin, and qi are quantiles Uses an approximation described in:
Levin, B.: A representation for multinomial cumulative distribution functions. Ann. Stat. 9, 1123<e2><80><93>1126 (1981)

Usage

1
pmultinom(q, n, prob, log.p = FALSE, lower.tail = TRUE)

Arguments

q

Vector of quantiles; If q has length 1 then the same quantile is used for each bin. If q is length k, each bin is assigned its own quantile

n

Total number of balls

prob

A vector of length k, describing the probability of a ball being placed into bin xk

log.p

If TRUE, natural logarithm of probability is returned (Default: FALSE)

lower.tail

logical; if TRUE, probabilities are P[X <= x], otherwise, P[X > x] (Default: TRUE)

Value

Numeric; A probability value. Returns the string "<2.2e-16" for extremely small probabilities

Author(s)

Fenner Macrae

See Also

dmultinom, pbinom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# For 4 balls randomly thrown into 2 bins, probability that all bins end up
# with 2 or fewer balls
pmultinom(q = 2, n = 4, prob = c(0.5, 0.5))

# For 6 balls randomly thrown into 3 bins, probability that at least one bin
# ends up with 3 or more balls
pmultinom(q = 2, n = 6, c(1/3, 1/3, 1/3))

# Same as above, but with different probabilities for each bin
pmultinom(q = 2, n = 6, c(0.2, 0.3, 0.5), lower.tail = FALSE)

# For 4 balls randomly thrown into 2 bins, probability that the first bin has
# 0 balls and the second bin has 4
pmultinom(q = c(0, 4), n = 4, c(0.5, 0.5), lower.tail = FALSE)

fennerm/pmultinom documentation built on May 19, 2019, 1:47 a.m.