Contents/ Part IX · Probability & Distributions Case Studies/ Chapter 53

Capture-Recapture: the Hypergeometric

Tag 100 fish, release them, net 30 more, and count the tags. Drawing without replacement is the hypergeometric distribution, and inverting it lets ecologists estimate a population they can never fully count. From 1,000 expeditions we fit the model and recover the lake's true size.

⏱️ ~13 min read
🐍 Notebook included
📊 Chapter 53

The binomial assumes every trial has the same probability, which is only true with replacement. Net a fish and keep it, and the odds shift for the next draw. Counting tagged fish in a catch from a finite lake is the hypergeometric distribution, and it underpins one of ecology's cleverest tricks.

H
The hypergeometric distribution counts the successes when drawing n items without replacement from a population of N containing K successes. Its mean is n·K/N, and its variance carries a finite-population correction.
🐟
The dataset

wildlife_capture_recapture.csv records 1,000 expeditions, each tagging K = 100 of N = 500 fish, then catching n = 30 and counting the tagged_fish_count. We model the recaptures and then run the model backward to estimate N.

1

Drawing Without Replacement

With 100 of 500 fish tagged, a fraction K/N = 0.2 of the lake carries a tag, so a catch of 30 should contain about n·K/N = 6 tagged fish. The observed mean is 5.91, and the hypergeometric PMF lands neatly on the data.

Tagged fish in a catch of 30: hypergeometric, mean n·K/N = 6 mean = 6 tagged fish in the catch →

Because the lake is finite and caught fish are not returned before the next draw, each catch slightly changes the remaining proportion of tags, so this is hypergeometric, not binomial. The distinction is small here but exact.

2

Without vs With Replacement

Had the fish been tossed back (or the lake been effectively infinite), the count would be Binomial(30, 0.2). Both models share the mean of 6, but the hypergeometric is tighter: drawing without replacement carries a finite-population correction that shrinks the variance.

Modelmeanvariance
Hypergeometric (without replacement)6.004.52
Binomial (with replacement)6.004.80
correction factor (N−n)/(N−1)0.942 × 4.80 = 4.52

The correction factor (N−n)/(N−1) = 0.94 is exactly the ratio of the two variances. When the sample is tiny relative to the population, the factor approaches 1 and the binomial becomes an excellent approximation, which is why the two distributions are so often used interchangeably.

3

Estimating the Uncountable

Here is the payoff. In a real survey N is unknown, that is the whole point. But if a fraction k/n of the catch is tagged and K fish are tagged in total, you can solve for the population: N̂ = K·n / k, the Lincoln-Petersen estimator.

🔁
A distribution, run backward, becomes a census

Averaged across expeditions, the simple Lincoln-Petersen estimate overshoots (mean ≈ 609), because dividing by a small recapture count k inflates it, a genuine bias. The bias-corrected Chapman estimator, (K+1)(n+1)/(k+1) − 1, fixes this and recovers the true N ≈ 500 (mean ≈ 513). This is the magic of capture-recapture: it measures a whole no one could ever count, the method behind wildlife censuses, estimating undiscovered software bugs, and even counting hidden human populations.

🐍

Run the recapture analysis

The companion notebook fits the hypergeometric to the tagged counts, compares its variance to the binomial via the finite-population correction, and inverts the model with both the Lincoln-Petersen and the bias-corrected Chapman estimators to recover the unknown population, every number from code.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub

View opens the rendered notebook instantly (no setup). Open in Colab runs & edits it live in your browser. To run locally, install numpy, pandas, scipy, and matplotlib and launch jupyter notebook.

🎓 Key Takeaways

  • Sampling without replacement is hypergeometric, not binomial; mean = n·K/N = 6 tagged per catch.
  • The finite-population correction (N−n)/(N−1) = 0.94 shrinks the variance below the binomial's.
  • When n « N, the correction approaches 1 and the binomial is a fine approximation.
  • Lincoln-Petersen N̂ = Kn/k estimates the unknown population, but overshoots; the Chapman estimator is bias-corrected.
  • Run a distribution backward and a sample becomes a census, the engine of capture-recapture across many fields.
4

Quiz: Test Yourself

Eight quick questions on the hypergeometric case study. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved, so you can hop back to the chapter and return anytime.