Hypergeometric Distribution

The hypergeometric distribution models the number of successes during sample from a finite population without replacement. If a random value X corresponds to hypergeometric distribution, the probability of getting exactly k successes in a sample containing n elements is described by the following formula:

Where:

Random values are generated using an algorithm (described by Fishman, 1978) based on inverse transform method. Algorithm is based on a recursive formula:

Starting with:

Thus, to generate a sample from hypergeometric distribution, we use an algorithm, which includes the following steps:

  1. If n < N - m, assume that:

xi = 0

Otherwise:

xi = nN + m

  1. Generate pseudo-random number uU(0, 1) distributed according to continuous uniform distribution at the interval (0, 1), when = 1 … ns.

  2. If u≤ p, the value xi is returned. Otherwise the previous three steps are repeated until the condition  u≤ p is fulfilled:

xx+ 1

uu– p

then the value xi is returned.

Steps 2 and 3 are executed ns times, each returned x value is one of the elements of the required sample.

See also:

ISmHyperGeometricDistribution | IStatistics.HypGeomDist | Library of Methods and Models