

   Hypergeometric {base}                        R Documentation

   TThhee HHyyppeerrggeeoommeettrriicc DDiissttrriibbuuttiioonn

   UUssaaggee::

        dhyper(x, m, n, k)
        phyper(q, m, n, k)
        qhyper(p, m, n, k)
        rhyper(nn, m, n, k)

   AArrgguummeennttss::

        x,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.

          p: probability, it must be between 0 and 1.

         nn: the number of observations to be generated.

   DDeettaaiillss::

        For large values of `k',

   VVaalluuee::

        These functions provide information about the hypergeo-
        metric distribution with parameters `m', `n' and `k'
        (named Np, N-Np, and n, respectively in the reference
        below).  `dhyper' gives the density, `phyper' gives the
        distribution function `qhyper' gives the quantile func-
        tion and `rhyper' generates random deviates.

        The hypergeometric distribution is used for sampling
        without replacement.  It has density

          p(x) = choose(m, x) choose(n, k-x) / choose(m+n, k)

        for x = 0, ..., k.

   RReeffeerreenncceess::

        Johnson, N.L., Kotz, S. and Kemp, A.W. (1992).  Uni-
        variate Discrete Distributions, 2nd Ed., Wiley.

   EExxaammpplleess::

        m <- 10; n <- 7; k <- 8
        x <- 0:m
        rbind(phyper(x, m, n, k), dhyper(x, m, n, k))
        all(phyper(x, m, n, k) == cumsum(dhyper(x, m, n, k)))# FALSE
        ## Error :
        signif(phyper(x, m, n, k) - cumsum(dhyper(x, m, n, k)), dig=3)

