Discrete distribution
Hypergeometric distribution
The number of marked items in a sample of drawn without replacement from a population of that contains marked ones: aces in a poker hand, defective parts in an inspected sample, tagged fish in a recapture. Because each draw changes what is left, the draws are not independent, which is what separates it from the binomial.
Hypergeometric probability calculator
P(X ≤ 3) = 0.659407
At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends. For a discrete distribution, < and ≤ differ.
PMF
CDF
mean 3 · variance 1.714 · sd 1.309 · mode 3
Formulas
| Parameters |
|
|---|---|
| Support | |
| PMF | |
| CDF | |
| Mean | |
| Variance | |
| Mode |
The factor is the finite-population correction: sampling without replacement gives a smaller variance than the binomial with .
Worked example
What is the probability that a five-card poker hand contains exactly two aces?
Draw from cards with aces: answer checked by code
How it relates to others
- Limit→ Binomial: If the population with fixed, drawing without replacement is like drawing with it: Hypergeometric() tends to Binomial(). checked by code
All the relationships, as a diagram →
In Python
from scipy import stats
import numpy as np
X = stats.hypergeom(M=50, n=15, N=10)
X.pmf(3) # P(X = 3) = 0.2979
X.cdf(3) # P(X ≤ 3) = 0.6594
X.mean(), X.var() # 3, 1.714
X.ppf(0.95) # 95th percentile
X.rvs(size=10, random_state=0)
rng = np.random.default_rng(0)
rng.hypergeometric(ngood=15, nbad=35, nsample=10, size=10)SciPy's letters differ from the page: its M is the population N, its n is the marked count K, and its N is the sample size n.
Choosing between this and its neighbours? Which distribution for count data?