Density, distribution function, quantile function and random generation for the hypergeometric distribution.
dhyper(x, m, n, k, log = FALSE) phyper(q, m, n, k, lower.tail = TRUE, log.p = FALSE) qhyper(p, m, n, k, lower.tail = TRUE, log.p = FALSE) rhyper(nn, m, n, k)
- x, q
- vector of quantiles representing the number of white balls drawn without replacement from an urn which contains both black and white balls.
- the number of white balls in the urn.
- the number of black balls in the urn.
- the number of balls drawn from the urn.
- probability, it must be between 0 and 1.
- number of observations. If
length(nn) > 1, the length is taken to be the number required.
- log, log.p
- logical; if TRUE, probabilities p are given as log(p).
- logical; if TRUE (default), probabilities are P[X ≤ x], otherwise, P[X > x].
The hypergeometric distribution is used for sampling without replacement. The density of this distribution with parameters
k (named Np, N-Np, and n, respectively in the reference below) is given by p(x) = choose(m, x) choose(n, k-x) / choose(m+n, k) for x = 0, ..., k.
The quantile is defined as the smallest value x such that F(x) ≥ p, where F is the distribution function.
Invalid arguments will result in return value
NaN, with a warning.
The length of the result is determined by
rhyper, and is the maximum of the lengths of the numerical parameters for the other functions. The numerical parameters other than
n are recycled to the length of the result. Only the first elements of the logical parameters are used.
Johnson, N. L., Kotz, S., and Kemp, A. W. (1992) Univariate Discrete Distributions, Second Edition. New York: Wiley.
Distributions for other standard distributions.
Documentation reproduced from R 3.0.1. License: GPL-2.