MultiHypergeometric function

Multivariate hypergeometric distribution

Multivariate hypergeometric distribution

Probability mass function and random generation for the multivariate hypergeometric distribution.

dmvhyper(x, n, k, log = FALSE) rmvhyper(nn, n, k)

Arguments

  • x: mm-column matrix of quantiles.
  • n: mm-length vector or mm-column matrix of numbers of balls in mm colors.
  • k: the number of balls drawn from the urn.
  • log: logical; if TRUE, probabilities p are given as log(p).
  • nn: number of observations. If length(n) > 1, the length is taken to be the number required.

Details

Probability mass function

f(x)=i=1m(nixi)(Nk)f(x)=prod(choose(n,x))/choose(N,k) f(x) = \frac{\prod_{i=1}^m {n_i \choose x_i}}{{N \choose k}}f(x) = prod(choose(n, x)) / choose(N, k)

The multivariate hypergeometric distribution is generalization of hypergeometric distribution. It is used for sampling without replacement kk out of NN marbles in mm colors, where each of the colors appears n[i]n[i] times. Where k=sum(x)k=sum(x), N=sum(n)N=sum(n) and k<=Nk<=N.

Examples

# Generating 10 random draws from multivariate hypergeometric # distribution parametrized using a vector rmvhyper(10, c(10, 12, 5, 8, 11), 33)

References

Gentle, J.E. (2006). Random number generation and Monte Carlo methods. Springer.

See Also

Hypergeometric

  • Maintainer: Tymoteusz Wolodzko
  • License: GPL-2
  • Last published: 2023-11-30