Hypergeometric Distribution Calculator (PMF, CDF, FPC)

Hypergeometric distribution calculator: PMF, CDF, survival, moments, comparison with binomial, finite population correction FPC, Fisher exact test 2x2.

Calculation parameters
Was this calculator useful?

Hypergeometric distribution: definition

Models the number of successes in n draws WITHOUT REPLACEMENT from finite population of N elements (K successes, N-K failures). Differs from binomial (with replacement) by dependent draws.

PMF: P(X = k) = C(K, k) C(N-K, n-k) / C(N, n) for k in [max(0, n-(N-K)), min(n, K)]

Parameters

  • N: total population size.
  • K: successes in population (0 <= K <= N).
  • n: sample size (1 <= n <= N).
  • k: observed successes in sample.

Numerical example

Urn with N=50 balls, K=10 black, 40 white. Draw n=12 without replacement. P(X=3 black) = C(10,3) C(40,9) / C(50,12) = 0.270. Mean = 2.4, SD = 1.219.

Moments

  • Mean: nK/N.
  • Variance: nK(N-K)(N-n) / (N^2 (N-1)).
  • FPC = (N-n)/(N-1): finite population correction. n << N: FPC ~ 1 (binomial). n = N: FPC = 0 (degenerate).

Connection with binomial

For N -> infinity with p = K/N fixed: hypergeometric -> binomial. Rule: n/N binomial OK. Hypergeometric variance is always smaller (FPC < 1).

Special cases

  • K = 0: P(X=0) = 1.
  • K = N: P(X=n) = 1.
  • n = 1: Bernoulli with p = K/N.
  • n = N: degenerate (X = K).
  • K = N/2 small n: nearly symmetric.

Fisher exact test

For 2x2 contingency tables. Under H0 (no association): cell count is hypergeometric. p-value = P(X >= a | margins fixed). Exact (not asymptotic), preferred to chi-square for small expected frequencies.

Applications

  • Quality control: lot acceptance sampling.
  • Capture-recapture (ecology): population estimation Lincoln-Petersen.
  • Lotteries: combination probabilities.
  • Medical: Fisher exact tests.
  • Genetics: rare individual sampling.
  • Surveys: finite population sampling.
  • Card games: poker, bridge probabilities.
  • A/B testing: small samples.

Generalizations

  • Multivariate hypergeometric: c categories.
  • Negative hypergeometric: draws to k successes.
  • Beta-binomial: variable probability limit.
  • Wallenius non-central: biased draws.

Capture-recapture

Capture K animals, mark, release. Capture n later, count k marked. Lincoln-Petersen: N_est = Kn/k. Chapman (less biased): (K+1)(n+1)/(k+1) - 1. Assumes closed population, no mark effect, homogeneous catchability.

History

Laplace (1812): first systematic study. Pearson (1899): formal analysis. Fisher (1922-1935): exact test for 2x2 tables. Lincoln (1930), Petersen (1896): capture-recapture. Chapman (1951): bias correction.

Calculator modes

Five modes: PMF, CDF, survival, moments with FPC, comparison with binomial. Computation via log factorials for numerical stability.

Fisher's exact test and 2x2 contingency tables

One of the most important uses of the hypergeometric distribution is not to compute a probability directly but to test an association. Arrange the outcomes of a small study in a two-by-two table, say a treatment versus a control against a success versus a failure, and ask whether the two rows differ more than chance allows. Under the null hypothesis that the row and column totals carry no relationship, the count in any single cell follows exactly a hypergeometric distribution, because fixing the margins is equivalent to drawing without replacement from a finite pool. This is the foundation of Fisher's exact test.

The test earns its name because it gives an exact probability rather than an approximation. Summing the hypergeometric probabilities of all tables as extreme or more extreme than the observed one yields a p-value without relying on the large-sample assumptions behind the chi-square test, which is why it is the standard choice when counts are small. Ronald Fisher devised it in the 1920s, famously illustrating it with the lady tasting tea, and it remains indispensable in medicine, genetics and any field where a contingency table must be judged on a handful of observations.

Sampling without replacement: quality control and games

The defining feature of the hypergeometric distribution is that each draw changes what remains, and nowhere is this more practical than in acceptance sampling. To decide whether to accept or reject a production lot, an inspector pulls a sample of n items from a batch of N and counts the defectives. Because the items are not returned, the exact probability of passing depends on the hypergeometric law, and quality engineers use it to design sampling plans that hold both the producer's and the consumer's risk to agreed limits. Treating the problem as binomial would overstate the confidence whenever the sample is a sizeable fraction of the lot.

Games of chance are the other everyday home of the distribution. The probability of drawing a given number of aces in a poker hand, of matching several numbers on a lottery ticket, or of holding a certain count of one suit in bridge are all hypergeometric, since cards and tickets are drawn without replacement. Comparing the hypergeometric result with the binomial one makes the effect of replacement concrete: removing each drawn item tightens the distribution around its mean, an adjustment captured by the finite-population correction factor, which shrinks the variance by the ratio of remaining to total population.

Updated July 2026

Frequently Asked Questions

What is the hypergeometric distribution?

It models the number of successes in n draws WITHOUT replacement from a finite population of N elements containing K successes. Its PMF is P(X=k) = C(K,k) C(N-K,n-k) / C(N,n). It differs from the binomial because the draws are not independent: each pick changes the remaining composition.

What do the parameters N, K, n, k represent?

N is the total population size, K the number of successes present in the population, n the size of the drawn sample and k the number of successes observed in the sample. The support of k runs from max(0, n-(N-K)) to min(n, K): outside this range the probability is zero.

What is the difference from the binomial distribution?

The binomial describes draws WITH replacement, in which the success probability stays constant and the trials are independent. The hypergeometric describes draws WITHOUT replacement from a finite population, so the trials are dependent. When n is very small relative to N the two distributions nearly coincide.

How are the mean and variance computed?

The mean is nK/N, exactly as for the binomial with p = K/N. The variance is nK(N-K)(N-n)/(N^2(N-1)), that is the binomial variance times the finite-population correction factor (N-n)/(N-1). This factor, always less than 1, reduces the variability compared to sampling with replacement.

What is the finite-population correction factor?

It is the term (N-n)/(N-1) that multiplies the binomial variance to give the hypergeometric one. It reflects that drawing without replacement reduces uncertainty: the larger the sample relative to the population, the further the factor moves from 1 and the more the distribution concentrates around the mean.

What is Fisher's exact test?

It is an association test for 2x2 contingency tables based on the hypergeometric distribution. With the row and column totals fixed, the count in a cell follows a hypergeometric under the null hypothesis. Summing the probabilities of the extreme cases gives an exact p-value, ideal when counts are small and the chi-square is unreliable.

How is it used in quality control?

In acceptance sampling one draws a sample of n items from a lot of N and counts the defectives. Because the items are not returned, the exact probability of accepting the lot is hypergeometric. Engineers use it to design sampling plans that control the producer's and consumer's risk.

How does it apply to estimating populations?

With the capture-recapture method: K animals are captured, marked and released; then a sample of n is captured and the k marked ones counted. The Lincoln-Petersen estimate is N = Kn/k, with the less biased Chapman correction (K+1)(n+1)/(k+1) - 1. It is fundamental in ecology and epidemiology.

Comments (0)

No comments yet. Be the first!