# Hypergeometric distribution probabilities

Calculates probabilities under a Hypergeometric distribution of parameters M, n and N.

## Hypergeometric distribution Formulas

We draw **without replacement** N objects from a set of M objects.

Among the N drawn objects, n objects have a specific feature. We call a "success" a draw of an object with the specific feature.

We have drawn,

• n objects corresponding to a success and,

• N-n objects corresponding to a failure

Let X be the random variable that counts the total number of successes.

Then X follows an hypergeometric distribution of parameters M, n and N and is written `X ~ N(M, n, N)`.

### Probability Mass function (PMF)

`P(X = k) = (([n], [k])*([M-n], [N-k]))/(([M],[N]))`

`([n], [k])` is the binomial coefficient also called 'n choose k',
`([n], [k]) = (n!)/(k! * (n-k)!)`

For P(X = k) to b a real number between 0 and 1, k must satisfy,

`max(0,N-M+n) <= k <= min(n,N)` (1)

(k must be less or equal to n in `([n], [k])` for the three binomial coefficients in above formula).
### Cumulative distribution function (CDF)

`P(X <= k) = sum_(i=max(0,N-M+n))^k (([n], [k])*([M-n], [N-k]))/(([M],[N]))` k satifying equation (1)

### Survival function

`P(X >= k) = sum_(i=k)^(min(n,N)) (([n], [k])*([M-n], [N-k]))/(([M],[N]))` k satisfying equation (1)

## See also

Measures on hypergeometric distribution

Hypergeometric distribution Histogram

Statistics Calculators