Learn R Programming

DPQ (version 0.5-9)

dhyperBinMolenaar: HyperGeometric (Point) Probabilities via Molenaar's Binomial Approximation

Description

Compute hypergeometric (point) probabilities via Molenaar's binomial approximation, hyper2binomP().

Usage

dhyperBinMolenaar(x, m, n, k, log = FALSE)

Value

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

Arguments

x

(vector of) 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 in \(0,1,\dots, m+n\).

log

logical indication if the logarithm log(P) should be returned (instead of \(P\)).

Author

Martin Maechler

References

See those in phyperBinMolenaar.

See Also

hyper2binomP(); R's own dhyper() which uses more sophisticated computations.

Examples

Run this code
## The function is simply defined as
function (x, m, n, k, log = FALSE)
  dbinom(x, size = k, prob = hyper2binomP(x, m, n, k), log = log)

Run the code above in your browser using DataLab