Hypergeometric             package:base             R Documentation

_T_h_e _H_y_p_e_r_g_e_o_m_e_t_r_i_c _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Density, distribution function, quantile function and random
     generation for the hypergeometric distribution.

_U_s_a_g_e:

     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)

_A_r_g_u_m_e_n_t_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.

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

lower.tail: logical; if TRUE (default), probabilities are P[X <= x],
          otherwise, P[X > x].

_D_e_t_a_i_l_s:

     The hypergeometric distribution is used for sampling without
     replacement.  The density of this distribution with parameters
     `m', `n' and `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.

_V_a_l_u_e:

     `dhyper' gives the density, `phyper' gives the distribution
     function, `qhyper' gives the quantile function, and `rhyper'
     generates random deviates.

_R_e_f_e_r_e_n_c_e_s:

     Johnson, N. L., Kotz, S., and Kemp, A. W. (1992) Univariate
     Discrete Distributions, Second Edition. New York: Wiley.

_E_x_a_m_p_l_e_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)

