Hypergeometric Distribution
The hypergeometric distribution is an extension of the binomial distribution.
Description
The binomial distribution describes sampling with replacement, such that the probability of an event success (p) is constant. The distribution then describes the number of event successes (k) for a fixed sample size (n).
The hypergeometric distribution describes sampling without replacement. There are N elements; r are successes and N-r are not successes. The number of ways to draw k successes with a sample size of n is given by:
This should be read as the number of ways to pick k from r, and then also pick n-k from N-r.
Therefore the hypergeometric distribution for a fixed sample size and population size is given by:
Naturally n cannot be greater than N, k cannot be greater than r, and n-k cannot be greater than N-r.
But it is possible for n to be less than r. Therefore k ≤ min(n,r) is the proper constraint.
Similarly, it is possible for n to be greater than N-r (i.e., some number of successes is guaranteed). Therefore max(0,n - N + r) ≤ k is the proper constraint.
Moments
The expected value is given as E[X] = nr/N.
Variance is given as Var[X] = n(N-n)r(N-r)/(N2(N-1)).
