FA-12591 / Survey sampling estimators / Open access
Normalizing inclusion weights changes a population total · case 01
Normalizing inclusion weights changes a population total.
ROOT CAUSE
A Horvitz-Thompson total is replaced by a normalized weighted mean.
VERIFIED REPAIR
Sum each observed value divided by its first-order inclusion probability.
Unsuccessful approach: Multiplying the normalized mean by sample size still discards the inclusion-probability scale.
Case contract
Rows are (value, positive inclusion probability <= 1); return the estimated population total rounded to eight decimals; empty sample totals zero.
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(rows):
return round(sum(y/p for y,p in rows)/sum(1/p for y,p in rows),8) if rows else 0
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal probabilities',solve([(N,0.5),(2*N,0.25)]),10*N)
check('single expanded unit',solve([(3*N,0.25)]),12*N)
check('census',solve([(N,1),(2*N,1)]),3*N)
check('zero valued sampled unit',solve([(0,0.5),(N,0.5)]),2*N)
check('signed contribution',solve([(-N,0.5),(N,1)]),-N)
check('empty sample',solve([]),0)
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 |
|---|---|---|---|
| unequal probabilities | 1.66666667 | 10 | Failed |
| single expanded unit | 3.0 | 12 | Failed |
| census | 1.5 | 3 | Failed |
| zero valued sampled unit | 0.5 | 2 | Failed |
| signed contribution | -0.33333333 | -1 | Failed |
| empty sample | 0 | 0 | Passed |
SHA-256 / 06c3c3a58f0c2cc092265d2cd66b440d27059163e6e3d0b213d0e441f6a228df
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows):
return round(len(rows)*sum(y/p for y,p in rows)/sum(1/p for y,p in rows),8) if rows else 0
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal probabilities',solve([(N,0.5),(2*N,0.25)]),10*N)
check('single expanded unit',solve([(3*N,0.25)]),12*N)
check('census',solve([(N,1),(2*N,1)]),3*N)
check('zero valued sampled unit',solve([(0,0.5),(N,0.5)]),2*N)
check('signed contribution',solve([(-N,0.5),(N,1)]),-N)
check('empty sample',solve([]),0)
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 |
|---|---|---|---|
| unequal probabilities | 3.33333333 | 10 | Failed |
| single expanded unit | 3.0 | 12 | Failed |
| census | 3.0 | 3 | Passed |
| zero valued sampled unit | 1.0 | 2 | Failed |
| signed contribution | -0.66666667 | -1 | Failed |
| empty sample | 0 | 0 | Passed |
SHA-256 / ad32ab58de4db5053d3bf8eabeb3390fc57e13aeab457e846f1ab4a48172519c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rows):
return round(sum(y/p for y,p in rows),8)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal probabilities',solve([(N,0.5),(2*N,0.25)]),10*N)
check('single expanded unit',solve([(3*N,0.25)]),12*N)
check('census',solve([(N,1),(2*N,1)]),3*N)
check('zero valued sampled unit',solve([(0,0.5),(N,0.5)]),2*N)
check('signed contribution',solve([(-N,0.5),(N,1)]),-N)
check('empty sample',solve([]),0)
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 |
|---|---|---|---|
| unequal probabilities | 10.0 | 10 | Passed |
| single expanded unit | 12.0 | 12 | Passed |
| census | 3.0 | 3 | Passed |
| zero valued sampled unit | 2.0 | 2 | Passed |
| signed contribution | -1.0 | -1 | Passed |
| empty sample | 0 | 0 | Passed |
SHA-256 / db2d82ba668d9a1c355a8f3b2a79032f726be70bbfcb81eef62c85e013cdc9ce
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.192597+00:00.
Case digest / 38d057a91797c37c53e4df97c20e03b78d211f554379de56388d6ac376d1afb2