Capture-recapture in R

Capture-recapture in R from scratch: abundance, survival and density from marked animals, with closed, open, multi-state and spatial models, and what each one assumes.

Every capture-recapture model is built on one idea: the animals you catch twice tell you about the animals you never catch at all. If marks come back often, you have caught much of the population. If they rarely do, there is more out there than you have seen. Everything else, a century of it, is that idea made precise under conditions where animals die, arrive, move, hide, and differ from one another.

This page collects every capture-recapture tutorial on this site. All of them build the likelihood by hand in base R, so the assumption that carries the estimate is visible in the code rather than buried in a package.

Closed, open, and why the word matters

A closed population does not change while you work: no births, no deaths, no movement in or out. That assumption is what lets a handful of occasions produce an abundance figure. It is also why closed models want a short study, and why the word “closed” should make you check the calendar before it makes you check the code.

Open models let animals die and arrive between occasions, which is honest but costs you something specific. The Cormack-Jolly-Seber model, the workhorse of open-population work, conditions on first capture and returns apparent survival: an animal that leaves for good is indistinguishable from one that died. That is not a bug to be fixed, it is the price of conditioning, and it is why abundance and recruitment need a superpopulation layer on top rather than a different likelihood underneath.

The recurring villain

Individual heterogeneity in capture probability is the thing that ruins capture-recapture estimates, and it does so quietly. Animals differ in how catchable they are; the catchable ones fill your marked sample; the population looks smaller than it is. Every serious model on this page either handles it, absorbs it into a parameter that then means something else, or fails a goodness-of-fit test that has little power against it. Sometimes heterogeneity leaves the point estimate almost alone and destroys the interval instead, which is worse, because the number looks fine.

The second recurring theme is that better design beats better likelihood. The robust design is the clearest case: closed periods nested inside an open study, which is a calendar change rather than a modelling trick, and it identifies parameters no amount of cleverness recovers from a badly spaced study.

Where the space comes in

Non-spatial models give you a number of animals, but not a density, because they do not know the area you sampled. Spatial capture-recapture fixes that by modelling where each animal lives: a latent activity centre per individual, a detection function that falls off with distance from it, and density as a parameter rather than a division at the end. It also turns trap spacing into a design question with an answer, since traps too far apart never record the spatial recaptures the model runs on.

The tutorials

Closed populations

Open populations: survival first

Open populations: abundance and growth

States, sites and uncertain reads

Space: where the animals live

Marks you do not recapture

Where this connects

Newsletter

Get new tutorials by email

New R and QGIS tutorials for ecologists, straight to your inbox. No spam; unsubscribe anytime.

By subscribing you agree to receive these emails and confirm your address once. See the privacy policy.