FAILURE MAP
← Case archive

FA-65516 / Ecological population dynamics / Open access

Two-sample mark-recapture abundance: recapture feasibility · case 01

Impossible samples with more recaptures than animals caught are estimated.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Recaptures are only checked against the marked count.

THE FAILURE

Recaptures are only checked against the marked count.

Unsuccessful approach: Checking against the larger sample still admits impossible data.

Case contract

Recaptures must be in [0, min(marked, caught)] else None; 'lp' = M*C/R ([None, None] when R=0, no variance); Chapman = (M+1)(C+1)/(R+1)-1 with variance (M+1)(C+1)(M-R)(C-R)/((R+1)^2 (R+2)); return [estimate rounded 2, variance rounded 2 or None].

Why this case matters

Population projections set harvest quotas, conservation status and pest-control timing; a wrong update order, boundary or rate conversion silently changes management advice.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(marked, caught, recaptured, method):
    if recaptured < 0 or recaptured > marked:
        return None
    if method == 'lp':
        if recaptured == 0:
            return [None, None]
        return [round(marked * caught / recaptured, 2), None]
    est = (marked + 1) * (caught + 1) / (recaptured + 1) - 1
    var = (marked + 1) * (caught + 1) * (marked - recaptured) * (caught - recaptured) / ((recaptured + 1) ** 2 * (recaptured + 2))
    return [round(est, 2), round(var, 2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('control: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None)],
 [('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('control: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('control: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('control: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('control: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('control: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('control: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('control: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control: trout chapman[580.95, 10077.1][580.95, 10077.1]Passed
control: trout petersen[600.0, None][600.0, None]Passed
control: zero recaptures chapman[2090.0, 2091000.0][2090.0, 2091000.0]Passed
control: zero recaptures petersen[None, None][None, None]Passed
control: all recaptured[30.0, 0.0][30.0, 0.0]Passed
regression: recaptures exceed catch[67.54, -51.22]NoneFailed
regression: recaptures exceed markedNoneNonePassed

SHA-256 / 1f04c3a49af229f7a12e685930a1f23d93d9ff8bdbd8259b7360820a1775f49b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(marked, caught, recaptured, method):
    if recaptured < 0 or recaptured > max(marked, caught):
        return None
    if method == 'lp':
        if recaptured == 0:
            return [None, None]
        return [round(marked * caught / recaptured, 2), None]
    est = (marked + 1) * (caught + 1) / (recaptured + 1) - 1
    var = (marked + 1) * (caught + 1) * (marked - recaptured) * (caught - recaptured) / ((recaptured + 1) ** 2 * (recaptured + 2))
    return [round(est, 2), round(var, 2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('control: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('control: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None)],
 [('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('control: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('control: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('control: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('control: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('control: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('control: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('regression: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('control: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
control: trout chapman[580.95, 10077.1][580.95, 10077.1]Passed
control: trout petersen[600.0, None][600.0, None]Passed
control: zero recaptures chapman[2090.0, 2091000.0][2090.0, 2091000.0]Passed
control: zero recaptures petersen[None, None][None, None]Passed
control: all recaptured[30.0, 0.0][30.0, 0.0]Passed
regression: recaptures exceed catch[67.54, -51.22]NoneFailed
regression: recaptures exceed marked[66.67, None]NoneFailed

SHA-256 / fe4d71be18b3e398a0b6dcdb4f570f2efc9e60efb3cbda42a1892a86bdfe02b8

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Deterministic bounded teaching model with a stipulated contract; not a validated scientific or public-health modelling library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:47:34.696343+00:00.

Case digest / 8f1fd3aafa25e0f06dd3d0b9d62c732c51bdc96ca7ac20655076a159b4580305