FAILURE MAP
← Case archive

FA-6336 / Statistics / Open access

Pooled sample variance rational · case 01

Equal averaging ignores unequal degrees of freedom.

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

ROOT CAUSE

Equal averaging ignores unequal degrees of freedom.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction((n1-1)*v1+(n2-1)*v2,n1+n2-2))

Unsuccessful approach: Sample sizes replace the degrees of freedom associated with sample variances.

Case contract

Integer finite observations and equal lengths for paired samples. Counts and weights are nonnegative. Rational results use reduced Fraction strings. Empty or undefined statistics return None where shown. n1,n2>=2 and v1,v2 are nonnegative integer unbiased within-group sample variances; pool by degrees of freedom. Exact operational definition: str(Fraction((n1-1)*v1+(n2-1)*v2,n1+n2-2))

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Statistical estimators results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n1, v1, n2, v2):
    return str(Fraction(v1+v2,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 1, 4, 3)', solve(*(2, 1, 4, 3)), '5/2')
check('fixture 2: (3, 2, 3, 4)', solve(*(3, 2, 3, 4)), '3')
check('fixture 3: (2, 0, 2, 0)', solve(*(2, 0, 2, 0)), '0')
check('fixture 4: (2, 4, 5, 1)', solve(*(2, 4, 5, 1)), '8/5')
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
fixture 1: (2, 1, 4, 3)25/2Failed
fixture 2: (3, 2, 3, 4)33Passed
fixture 3: (2, 0, 2, 0)00Passed
fixture 4: (2, 4, 5, 1)5/28/5Failed

SHA-256 / 04a79cef878ed1881f2da8f9ba312e79ab20f94c362ea7b95da0d15ac4b84cfc

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n1, v1, n2, v2):
    return str(Fraction(n1*v1+n2*v2,n1+n2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 1, 4, 3)', solve(*(2, 1, 4, 3)), '5/2')
check('fixture 2: (3, 2, 3, 4)', solve(*(3, 2, 3, 4)), '3')
check('fixture 3: (2, 0, 2, 0)', solve(*(2, 0, 2, 0)), '0')
check('fixture 4: (2, 4, 5, 1)', solve(*(2, 4, 5, 1)), '8/5')
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
fixture 1: (2, 1, 4, 3)7/35/2Failed
fixture 2: (3, 2, 3, 4)33Passed
fixture 3: (2, 0, 2, 0)00Passed
fixture 4: (2, 4, 5, 1)13/78/5Failed

SHA-256 / b41a0b31cd22b4bb5b53d478d6645106c95116ad04b90f7d40d7988155afb8ac

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n1, v1, n2, v2):
    return str(Fraction((n1-1)*v1+(n2-1)*v2,n1+n2-2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (2, 1, 4, 3)', solve(*(2, 1, 4, 3)), '5/2')
check('fixture 2: (3, 2, 3, 4)', solve(*(3, 2, 3, 4)), '3')
check('fixture 3: (2, 0, 2, 0)', solve(*(2, 0, 2, 0)), '0')
check('fixture 4: (2, 4, 5, 1)', solve(*(2, 4, 5, 1)), '8/5')
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
fixture 1: (2, 1, 4, 3)5/25/2Passed
fixture 2: (3, 2, 3, 4)33Passed
fixture 3: (2, 0, 2, 0)00Passed
fixture 4: (2, 4, 5, 1)8/58/5Passed

SHA-256 / ac650dc1baea8a1b9158bb632b49c4ed78665ad46c02796e7a35531bba6cdd3d

Verification & scope

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

Case digest / a8fc110cb03832baef2fa0e1b456ac78c2827aca5ea0b039f87d06f68209c36a