Learn R Programming

DPQ (version 0.5-9)

phyperBinMolenaar: HyperGeometric Distribution via Molenaar's Binomial Approximation

Description

Compute hypergeometric cumulative probabilities via Molenaar's binomial approximations. The arguments of these functions are exactly those of R's own phyper().

Usage

phyperBinMolenaar.1(q, m, n, k, lower.tail = TRUE, log.p = FALSE)
phyperBinMolenaar.2(q, m, n, k, lower.tail = TRUE, log.p = FALSE)
phyperBinMolenaar.3(q, m, n, k, lower.tail = TRUE, log.p = FALSE)
phyperBinMolenaar.4(q, m, n, k, lower.tail = TRUE, log.p = FALSE)

phyperBinMolenaar (q, m, n, k, lower.tail = TRUE, log.p = FALSE) # Deprecated !

Value

a numeric vector, with the length the maximum of the lengths of q, m, n, k.

Arguments

q

vector of quantiles representing the number of white balls drawn without replacement from an urn which contains both black and white balls.

m

the number of white balls in the urn.

n

the number of black balls in the urn.

k

the number of balls drawn from the urn, hence must be in \(0,1,\dots, m+n\).

lower.tail

logical; if TRUE (default), probabilities are \(P[X \le x]\), otherwise, \(P[X > x]\).

log.p

logical; if TRUE, probabilities p are given as log(p).

Author

Martin Maechler

Details

Molenaar(1970), as cited in Johnson et al (1992), proposed phyperBinMolenaar.1(); the other three are just using the mathematical symmetries of the hyperbolic distribution, swapping \(k\) and \(m\), and using lower.tail = TRUE or FALSE.

References

Johnson, N.L., Kotz, S. and Kemp, A.W. (1992) Univariate Discrete Distributions, 2nd ed.; Wiley, tools:::Rd_expr_doi("10.1002/bimj.4710360207").
Chapter 6, mostly Section 5 Approximations and Bounds, p.256 ff

Johnson, N.L., Kotz, S. and Kemp, A.W. (2005) Univariate Discrete Distributions, 3rd ed.; Wiley; tools:::Rd_expr_doi("10.1002/0471715816").
Chapter 6, Section 6.5 Approximations and Bounds, p.268 ff

See Also

phyper, the hypergeometric distribution, and R's own “exact” computation. pbinom, the binomial distribution functions.

Our utility phyperAllBin().

Examples

Run this code
## The first function is simply
function (q, m, n, k, lower.tail = TRUE, log.p = FALSE)
  pbinom(q, size = k, prob = hyper2binomP(q, m, n, k), lower.tail = lower.tail,
        log.p = log.p)

Run the code above in your browser using DataLab