Hypergeometric Distribution



Hypergeometric Distribution

Given a container of n1 objects of type 1 and n2 objects of type 2, the probability of drawing k objects of type 1 when a total of n objects are drawn at random without replacement is
f(k) =
Cn1k Cn2n-k / Cn1+n2n for k = 0,...,min(n1,n)
0elsewhere

The cumulative hypergeometric distribution function is therefore given
F(k) = Σi=0k f(i),
where f is given above.

Function List

  • double Hypergeometric_Cumulative_Distribution( int n1, int n2, int n, int k )

    This function returns F(k) where F(k) is described above.

  • double Hypergeometric_Point_Distribution( int n1, int n2, int n, int k )

    This function returns f(k) where f(k) is described above.

  • void Hypergeometric_Distribution_Tables( int n1, int n2, int n, double* pr, double* cumulative )

    This function returns f(k) where f(k) is described above for k = 0,...,n in the array pr and returns F(k) where F(k) is described above for k = 0,...,n in the array cumulative.

Source Code

C source code is available for these routines: