FA-12621 / Survey sampling estimators / Open access
A census retains sampling variance · case 01
A census retains sampling variance.
ROOT CAUSE
The without-replacement finite population correction is omitted.
VERIFIED REPAIR
Multiply the supplied sample variance divided by sample size by one minus sampling fraction.
Unsuccessful approach: Applying the correction to standard error instead of variance squares it.
Case contract
Inputs are nonnegative sample variance s2, integers 1<=n<=population. Return variance of SRS without-replacement mean, rounded to eight decimals; s2 is supplied rather than estimated here.
Why this case matters
A deterministic survey-design model isolates this sampling contract before it is embedded in a larger estimation pipeline.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s2, n, population):
return round(s2/n,8)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('half population',solve(8*N,2,4),2*N)
check('census zero uncertainty',solve(8*N,4,4),0)
check('quarter population',solve(8*N,2,8),3*N)
check('zero dispersion',solve(0,2,8),0)
check('one draw modeled variance',solve(4*N,1,2),2*N)
check('three quarters',solve(12*N,3,4),N)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| half population | 4.0 | 2 | Failed |
| census zero uncertainty | 2.0 | 0 | Failed |
| quarter population | 4.0 | 3 | Failed |
| zero dispersion | 0.0 | 0 | Passed |
| one draw modeled variance | 4.0 | 2 | Failed |
| three quarters | 4.0 | 1 | Failed |
SHA-256 / 5ce25f4898cdc153b5f3ed35634dae86d0e01340d6e47a780dea484b163f5510
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s2, n, population):
return round((1-n/population)**2*s2/n,8)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('half population',solve(8*N,2,4),2*N)
check('census zero uncertainty',solve(8*N,4,4),0)
check('quarter population',solve(8*N,2,8),3*N)
check('zero dispersion',solve(0,2,8),0)
check('one draw modeled variance',solve(4*N,1,2),2*N)
check('three quarters',solve(12*N,3,4),N)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| half population | 1.0 | 2 | Failed |
| census zero uncertainty | 0.0 | 0 | Passed |
| quarter population | 2.25 | 3 | Failed |
| zero dispersion | 0.0 | 0 | Passed |
| one draw modeled variance | 1.0 | 2 | Failed |
| three quarters | 0.25 | 1 | Failed |
SHA-256 / 43a6b574008d30f25a418425de4fabbae333d75e583d68fcbce7190679549d5a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s2, n, population):
return round((1-n/population)*s2/n,8)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('half population',solve(8*N,2,4),2*N)
check('census zero uncertainty',solve(8*N,4,4),0)
check('quarter population',solve(8*N,2,8),3*N)
check('zero dispersion',solve(0,2,8),0)
check('one draw modeled variance',solve(4*N,1,2),2*N)
check('three quarters',solve(12*N,3,4),N)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| half population | 2.0 | 2 | Passed |
| census zero uncertainty | 0.0 | 0 | Passed |
| quarter population | 3.0 | 3 | Passed |
| zero dispersion | 0.0 | 0 | Passed |
| one draw modeled variance | 2.0 | 2 | Passed |
| three quarters | 1.0 | 1 | Passed |
SHA-256 / 0c7971826df123ca9c43c8220af0ddfdd72ef7039611055ddafe82865b172566
Verification & scope
Controlled finite fixtures; not a general survey-analysis package. 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:38:58.620480+00:00.
Case digest / 179d158aba76bac57f34b6cf37deac97a25a8dca07bca16a3fb9277a30119f21