FAILURE MAP
← Case archive

FA-12626 / Survey sampling estimators / Open access

Secondary records inflate survey variance degrees of freedom · case 01

Secondary records inflate survey variance degrees of freedom.

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

ROOT CAUSE

Rows are counted as independent primary sampling units.

THE FAILURE

Rows are counted as independent primary sampling units.

Unsuccessful approach: Globally deduplicating primary-unit labels merges distinct units from different strata.

Case contract

Rows are (stratum, PSU label) for noncertainty strata; labels are unique only within a stratum. Return sum_h(number of distinct sampled PSUs_h - 1), with empty input 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 len(rows)-len({h for h,p in rows})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('secondary records repeated',solve([('a',N),('a',N),('a',N+1)]),1)
check('labels reused across strata',solve([('a',N),('a',N+1),('b',N),('b',N+1)]),2)
check('lonely PSU stratum',solve([('a',N),('a',N)]),0)
check('empty sample',solve([]),0)
check('one stratum three PSUs',solve([('a',N),('a',N+1),('a',N+2)]),2)
check('mixed counts',solve([('a',N),('b',N),('b',N+1),('b',N+1)]),1)
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
secondary records repeated21Failed
labels reused across strata22Passed
lonely PSU stratum10Failed
empty sample00Passed
one stratum three PSUs22Passed
mixed counts21Failed

SHA-256 / 1222be955568b3bec81c4639ea55bc5c80fe6f24fdeadf76c1d514367ca5b191

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows):
    return len({p for h,p in rows})-len({h for h,p in rows})
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('secondary records repeated',solve([('a',N),('a',N),('a',N+1)]),1)
check('labels reused across strata',solve([('a',N),('a',N+1),('b',N),('b',N+1)]),2)
check('lonely PSU stratum',solve([('a',N),('a',N)]),0)
check('empty sample',solve([]),0)
check('one stratum three PSUs',solve([('a',N),('a',N+1),('a',N+2)]),2)
check('mixed counts',solve([('a',N),('b',N),('b',N+1),('b',N+1)]),1)
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
secondary records repeated11Passed
labels reused across strata02Failed
lonely PSU stratum00Passed
empty sample00Passed
one stratum three PSUs22Passed
mixed counts01Failed

SHA-256 / 84125a213fc1aa8d7936426165a4f51b3d6b8c327858d714ace3d1bbbba5ecbf

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

Case digest / 9ed876ec7fa0dd29fd0c0b662aa32ebfd969f6be9351b9a0926a6af13340b33b