{"abstract":"Marginal weights omit the first sampling stage.","category":"Survey sampling estimators","checks":6,"contract":"Rows are (value, primary probability, conditional secondary probability), both probabilities in (0,1]; return the total rounded to eight decimals.","evaluation_group":"model-20fac15dd76f4d3f","failed_approach":"Adding stage probabilities double-counts paths and can exceed one.","family":"z-survey_sampling-stage-probabilities","id":"FA-12596","implementations":{"attempt":{"sha256":"9a76fa8f3c23343a611268e88b156a9e86bc38c9c10fad647a9683e7ba6e5013","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows):\n    return round(sum(y/min(1,p+q) for y,p,q in rows),8)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two half stages',solve([(N,0.5,0.5)]),4*N)\ncheck('certain primary',solve([(N,1,0.25)]),4*N)\ncheck('certain secondary',solve([(N,0.25,1)]),4*N)\ncheck('census both',solve([(N,1,1)]),N)\ncheck('heterogeneous paths',solve([(N,0.5,0.25),(N,1,0.5)]),10*N)\ncheck('no observed units',solve([]),0)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"3ae5188aa40783930b1eded1f4c782272a1eb7146254295202bf2b0bfd42f7fd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows):\n    return round(sum(y/q for y,p,q in rows),8)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two half stages',solve([(N,0.5,0.5)]),4*N)\ncheck('certain primary',solve([(N,1,0.25)]),4*N)\ncheck('certain secondary',solve([(N,0.25,1)]),4*N)\ncheck('census both',solve([(N,1,1)]),N)\ncheck('heterogeneous paths',solve([(N,0.5,0.25),(N,1,0.5)]),10*N)\ncheck('no observed units',solve([]),0)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"7d2ce787426c8d87b76f1b36656de174d9aac75c313506981af462df1ff5e78a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows):\n    return round(sum(y/(p*q) for y,p,q in rows),8)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('two half stages',solve([(N,0.5,0.5)]),4*N)\ncheck('certain primary',solve([(N,1,0.25)]),4*N)\ncheck('certain secondary',solve([(N,0.25,1)]),4*N)\ncheck('census both',solve([(N,1,1)]),N)\ncheck('heterogeneous paths',solve([(N,0.5,0.25),(N,1,0.5)]),10*N)\ncheck('no observed units',solve([]),0)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"z-survey_sampling-stage-probabilities","generated_at":"2026-09-29T14:38:58.320870+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic survey-design model isolates this sampling contract before it is embedded in a larger estimation pipeline.","repair":"Multiply primary and conditional secondary inclusion probabilities before inversion.","root_cause":"Only the conditional secondary-unit inclusion probability is inverted.","sha256":"02221009cc253d7a153033e47d035759162b18c6891dcd2b4b7f0b6879ce7780","title":"Marginal weights omit the first sampling stage · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.726,"exit_code":1,"observations":[{"actual":1.0,"check":"two half stages","expected":4,"passed":false},{"actual":1.0,"check":"certain primary","expected":4,"passed":false},{"actual":1.0,"check":"certain secondary","expected":4,"passed":false},{"actual":1.0,"check":"census both","expected":1,"passed":true},{"actual":2.33333333,"check":"heterogeneous paths","expected":10,"passed":false},{"actual":0,"check":"no observed units","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two half stages\", \"actual\": 1.0, \"expected\": 4, \"passed\": false}, {\"check\": \"certain primary\", \"actual\": 1.0, \"expected\": 4, \"passed\": false}, {\"check\": \"certain secondary\", \"actual\": 1.0, \"expected\": 4, \"passed\": false}, {\"check\": \"census both\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"heterogeneous paths\", \"actual\": 2.33333333, \"expected\": 10, \"passed\": false}, {\"check\": \"no observed units\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.005,"exit_code":1,"observations":[{"actual":2.0,"check":"two half stages","expected":4,"passed":false},{"actual":4.0,"check":"certain primary","expected":4,"passed":true},{"actual":1.0,"check":"certain secondary","expected":4,"passed":false},{"actual":1.0,"check":"census both","expected":1,"passed":true},{"actual":6.0,"check":"heterogeneous paths","expected":10,"passed":false},{"actual":0,"check":"no observed units","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two half stages\", \"actual\": 2.0, \"expected\": 4, \"passed\": false}, {\"check\": \"certain primary\", \"actual\": 4.0, \"expected\": 4, \"passed\": true}, {\"check\": \"certain secondary\", \"actual\": 1.0, \"expected\": 4, \"passed\": false}, {\"check\": \"census both\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"heterogeneous paths\", \"actual\": 6.0, \"expected\": 10, \"passed\": false}, {\"check\": \"no observed units\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.386,"exit_code":0,"observations":[{"actual":4.0,"check":"two half stages","expected":4,"passed":true},{"actual":4.0,"check":"certain primary","expected":4,"passed":true},{"actual":4.0,"check":"certain secondary","expected":4,"passed":true},{"actual":1.0,"check":"census both","expected":1,"passed":true},{"actual":10.0,"check":"heterogeneous paths","expected":10,"passed":true},{"actual":0,"check":"no observed units","expected":0,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two half stages\", \"actual\": 4.0, \"expected\": 4, \"passed\": true}, {\"check\": \"certain primary\", \"actual\": 4.0, \"expected\": 4, \"passed\": true}, {\"check\": \"certain secondary\", \"actual\": 4.0, \"expected\": 4, \"passed\": true}, {\"check\": \"census both\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"heterogeneous paths\", \"actual\": 10.0, \"expected\": 10, \"passed\": true}, {\"check\": \"no observed units\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}