FAILURE MAP
← Case archive

FA-6251 / Statistics / Open access

Regression intercept given slope · case 01

The sample mean is returned without removing the slope contribution.

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

ROOT CAUSE

The sample mean is returned without removing the slope contribution.

THE FAILURE

The sample mean is returned without removing the slope contribution.

Unsuccessful approach: The slope contribution is added rather than subtracted.

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. Nonempty paired samples and an integer slope are provided; return the intercept making the mean residual zero. Exact operational definition: str(Fraction(sum(y),len(y))-slope*Fraction(sum(x),len(x)))

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(x, y, slope):
    return str(Fraction(sum(y),len(y)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [3, 5, 7], 2)', solve(*([1, 2, 3], [3, 5, 7], 2)), '1')
check('fixture 2: ([0, 1], [2, 2], 0)', solve(*([0, 1], [2, 2], 0)), '2')
check('fixture 3: ([1, 2], [3, 2], -1)', solve(*([1, 2], [3, 2], -1)), '4')
check('fixture 4: ([-1, 1], [-2, 2], 2)', solve(*([-1, 1], [-2, 2], 2)), '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
fixture 1: ([1, 2, 3], [3, 5, 7], 2)51Failed
fixture 2: ([0, 1], [2, 2], 0)22Passed
fixture 3: ([1, 2], [3, 2], -1)5/24Failed
fixture 4: ([-1, 1], [-2, 2], 2)00Passed

SHA-256 / 0d7eeffff7775e6f34adadbdeaca49d8661ff2c10d327f5282d7a71fc8a40432

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(x, y, slope):
    return str(Fraction(sum(y),len(y))+slope*Fraction(sum(x),len(x)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3], [3, 5, 7], 2)', solve(*([1, 2, 3], [3, 5, 7], 2)), '1')
check('fixture 2: ([0, 1], [2, 2], 0)', solve(*([0, 1], [2, 2], 0)), '2')
check('fixture 3: ([1, 2], [3, 2], -1)', solve(*([1, 2], [3, 2], -1)), '4')
check('fixture 4: ([-1, 1], [-2, 2], 2)', solve(*([-1, 1], [-2, 2], 2)), '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
fixture 1: ([1, 2, 3], [3, 5, 7], 2)91Failed
fixture 2: ([0, 1], [2, 2], 0)22Passed
fixture 3: ([1, 2], [3, 2], -1)14Failed
fixture 4: ([-1, 1], [-2, 2], 2)00Passed

SHA-256 / c147d635019a0929d7c39770c06bb2741a4a6918241165a2295afecc9bce7ceb

HELD IN THE MEMBER ARCHIVE

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

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

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

Case digest / 04525029529f5a773bbb4c71fce6256a8c2791832deebff67732bbca5f262643