FAILURE MAP
← Case archive

FA-12606 / Survey sampling estimators / Open access

Domain filtering silently changes the target denominator · case 01

Domain filtering silently changes the target denominator.

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

ROOT CAUSE

A subpopulation total is divided by observed domain membership rather than the known domain population.

THE FAILURE

A subpopulation total is divided by observed domain membership rather than the known domain population.

Unsuccessful approach: Dividing by estimated domain weight changes the specified HT domain mean into a ratio estimator.

Case contract

Rows are (value, inverse-inclusion weight, in-domain boolean); domain_size is a known nonnegative population count. Return HT domain total/domain_size, or None when size is zero, rounded to eight decimals.

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, domain_size):
    d=[(y,w) for y,w,in_domain in rows if in_domain]
    return round(sum(y*w for y,w in d)/len(d),8) if d else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('known domain denominator',solve([(2*N,2,True),(99,10,False)],8),N/2)
check('no sampled domain members',solve([(N,1,False)],4),0)
check('zero population domain',solve([],0),None)
check('census domain',solve([(N,1,True),(3*N,1,True)],2),2*N)
check('unequal weighted members',solve([(N,2,True),(2*N,4,True)],5),2*N)
check('outside values do not contribute',solve([(0,4,True),(100*N,2,False)],8),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 fixtureActualExpectedOutcome
known domain denominator4.00.5Failed
no sampled domain membersNone0Failed
zero population domainNoneNonePassed
census domain2.02Passed
unequal weighted members5.02Failed
outside values do not contribute0.00Passed

SHA-256 / 73c50334b18e58529963b4b28f2ae344811979df2e90621f8e1b2dca67a53b54

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, domain_size):
    d=[(y,w) for y,w,in_domain in rows if in_domain]
    return round(sum(y*w for y,w in d)/sum(w for y,w in d),8) if d else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('known domain denominator',solve([(2*N,2,True),(99,10,False)],8),N/2)
check('no sampled domain members',solve([(N,1,False)],4),0)
check('zero population domain',solve([],0),None)
check('census domain',solve([(N,1,True),(3*N,1,True)],2),2*N)
check('unequal weighted members',solve([(N,2,True),(2*N,4,True)],5),2*N)
check('outside values do not contribute',solve([(0,4,True),(100*N,2,False)],8),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 fixtureActualExpectedOutcome
known domain denominator2.00.5Failed
no sampled domain membersNone0Failed
zero population domainNoneNonePassed
census domain2.02Passed
unequal weighted members1.666666672Failed
outside values do not contribute0.00Passed

SHA-256 / 3a3abd7649134bbc9c616e8d7fcc9e2042de9335be2e558ba08d1bff61ec8366

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 6 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

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

Case digest / dd4858ad3958e42dd5ded707ebc975185cda2f99f2c6033033da96cb834e6915