FAILURE MAP
← Case archive

FA-65511 / Ecological population dynamics / Open access

Two-sample mark-recapture abundance: variance denominator · case 01

Confidence intervals are far too wide.

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

ROOT CAUSE

The variance denominator squares the wrong factor.

THE FAILURE

The variance denominator squares the wrong factor.

Unsuccessful approach: Cubing R+1 is not (R+1)^2 (R+2).

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 > min(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) * (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 = [[('regression: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: 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]),
  ('control: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8])],
 [('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('control: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('control: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('regression: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('regression: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('regression: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('regression: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: 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: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('regression: 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]),
  ('control: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('control: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('regression: 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
regression: trout chapman[580.95, 211619.05][580.95, 10077.1]Failed
control: trout petersen[600.0, None][600.0, None]Passed
regression: 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
control: recaptures exceed catchNoneNonePassed
regression: small sample[51.0, 1123.2][51.0, 280.8]Failed

SHA-256 / 114f8113beeb01da0bc212299011b47f1510568eb424a74f8660c7af145c9071

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 > min(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) ** 3
    return [round(est, 2), round(var, 2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: 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]),
  ('control: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8])],
 [('control: zero recaptures petersen', (50, 40, 0, 'lp'), [None, None]),
  ('control: all recaptured', (30, 30, 30, 'chapman'), [30.0, 0.0]),
  ('control: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('control: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('regression: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('regression: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: zero recaptures chapman', (50, 40, 0, 'chapman'), [2090.0, 2091000.0]),
  ('control: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('regression: butterflies', (200, 150, 45, 'chapman'), [658.8, 4966.84]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('regression: trout chapman', (120, 100, 20, 'chapman'), [580.95, 10077.1]),
  ('control: trout petersen', (120, 100, 20, 'lp'), [600.0, None]),
  ('regression: 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: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('control: negative recapture', (20, 20, -1, 'lp'), None)],
 [('regression: 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]),
  ('control: recaptures exceed catch', (80, 10, 12, 'chapman'), None),
  ('control: recaptures exceed marked', (10, 80, 12, 'lp'), None),
  ('regression: small sample', (15, 12, 3, 'chapman'), [51.0, 280.8]),
  ('regression: 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
regression: trout chapman[580.95, 10556.96][580.95, 10077.1]Failed
control: trout petersen[600.0, None][600.0, None]Passed
regression: zero recaptures chapman[2090.0, 4182000.0][2090.0, 2091000.0]Failed
control: zero recaptures petersen[None, None][None, None]Passed
control: all recaptured[30.0, 0.0][30.0, 0.0]Passed
control: recaptures exceed catchNoneNonePassed
regression: small sample[51.0, 351.0][51.0, 280.8]Failed

SHA-256 / 714ba36bb479ea755038d5df3764e736745e8e03f66571c9b402567481d9483f

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.655507+00:00.

Case digest / ad9ebedffa7057eda77071a4d3f18d6e8c753611ccb7fd80f6d03503c24a2f63