FAILURE MAP
← Case archive

FA-63021 / Insurance premium rating / Open access

Parallelogram on-level factor: Prior-year change area is complemented incorrectly · case 01

Changes effective late in the prior year are treated as barely earned.

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

ROOT CAUSE

The prior-year branch returns the uncovered triangle instead of its complement.

VERIFIED REPAIR

Return 1-(1+d)^2/2.

Unsuccessful approach: Linearising the triangle still misstates the share.

Case contract

Input changes [[month offset from calendar-year start, change per mille]] in order. Annual policies written uniformly; the share of calendar-year earned exposure written after offset d=m/12 is (1-d)^2/2 for 0<=d<1, 1-(1+d)^2/2 for -1<d<0, 0 for d>=1 and 1 for d<=-1. Levels are cumulative products. OLF = current level / earned-weighted average level, returned *1000 rounded half-up.

Why this case matters

On-level factors restate historical earned premium at current rates before comparing to losses.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    def after(m):
        d=Fraction(m,12)
        if d>=1: return Fraction(0)
        if d<=-1: return Fraction(1)
        if d>=0: return (1-d)**2/2
        return (1+d)**2/2
    level=Fraction(1); levels=[level]
    for m,c in x['changes']:
        level*=1+Fraction(c,1000); levels.append(level)
    avg=Fraction(0)
    prev=Fraction(1)
    for i,(m,c) in enumerate(x['changes']):
        a=after(m)
        avg+=levels[i]*(prev-a)
        prev=a
    avg+=levels[-1]*prev
    return math.floor(levels[-1]/avg*1000+Fraction(1,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['single mid-year change', {'changes': [[3, 100]]}, 1070], ['change in prior year', {'changes': [[-7, 45]]}, 1004], ['two changes straddling', {'changes': [[-8, 45], [2, -50]]}, 969], ['three changes', {'changes': [[-9, 30], [3, 100], [8, -50]]}, 1020], ['change at year start', {'changes': [[0, 45]]}, 1022], ['change long before period', {'changes': [[-14, -50], [3, 100]]}, 1070], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[10, -80]]}, 921]], [['single mid-year change', {'changes': [[5, 60]]}, 1049], ['change in prior year', {'changes': [[-8, 30]]}, 1002], ['two changes straddling', {'changes': [[-6, 80], [6, 60]]}, 1062], ['three changes', {'changes': [[-6, 30], [4, 30], [7, 100]]}, 1120], ['change at year start', {'changes': [[0, 80]]}, 1038], ['change long before period', {'changes': [[-14, 100], [4, -50]]}, 961], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[6, -80]]}, 929]], [['single mid-year change', {'changes': [[8, 60]]}, 1056], ['change in prior year', {'changes': [[-3, -50]]}, 985], ['two changes straddling', {'changes': [[-7, 100], [2, 100]]}, 1071], ['three changes', {'changes': [[-11, -50], [0, -50], [10, 100]]}, 1070], ['change at year start', {'changes': [[0, 100]]}, 1048], ['change long before period', {'changes': [[-14, -50], [4, 30]]}, 1023], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[4, -80]]}, 937]], [['single mid-year change', {'changes': [[4, 80]]}, 1061], ['change in prior year', {'changes': [[-9, 60]]}, 1002], ['two changes straddling', {'changes': [[-4, 80], [8, 100]]}, 1112], ['three changes', {'changes': [[-2, 30], [2, 60], [8, 60]]}, 1108], ['change at year start', {'changes': [[0, 45]]}, 1022], ['change long before period', {'changes': [[-14, 30], [4, 60]]}, 1046], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[2, -80]]}, 946]], [['single mid-year change', {'changes': [[9, -50]]}, 951], ['change in prior year', {'changes': [[-5, -50]]}, 991], ['two changes straddling', {'changes': [[-8, 80], [5, -50]]}, 962], ['three changes', {'changes': [[-3, 80], [5, 30], [7, 60]]}, 1103], ['change at year start', {'changes': [[0, 100]]}, 1048], ['change long before period', {'changes': [[-14, 45], [4, 60]]}, 1046], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[4, -80]]}, 937]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
single mid-year change10701070Passed
change in prior year10411004Failed
two changes straddling1009969Failed
three changes10481020Failed
change at year start10221022Passed
change long before period10701070Passed
no changes10001000Passed
rate decrease921921Passed

SHA-256 / ce30e4e9c914abe65e430934b743ac2de7447286db790b1b898537b5ea2ad188

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    def after(m):
        d=Fraction(m,12)
        if d>=1: return Fraction(0)
        if d<=-1: return Fraction(1)
        if d>=0: return (1-d)**2/2
        return 1-(1+d)/2
    level=Fraction(1); levels=[level]
    for m,c in x['changes']:
        level*=1+Fraction(c,1000); levels.append(level)
    avg=Fraction(0)
    prev=Fraction(1)
    for i,(m,c) in enumerate(x['changes']):
        a=after(m)
        avg+=levels[i]*(prev-a)
        prev=a
    avg+=levels[-1]*prev
    return math.floor(levels[-1]/avg*1000+Fraction(1,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['single mid-year change', {'changes': [[3, 100]]}, 1070], ['change in prior year', {'changes': [[-7, 45]]}, 1004], ['two changes straddling', {'changes': [[-8, 45], [2, -50]]}, 969], ['three changes', {'changes': [[-9, 30], [3, 100], [8, -50]]}, 1020], ['change at year start', {'changes': [[0, 45]]}, 1022], ['change long before period', {'changes': [[-14, -50], [3, 100]]}, 1070], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[10, -80]]}, 921]], [['single mid-year change', {'changes': [[5, 60]]}, 1049], ['change in prior year', {'changes': [[-8, 30]]}, 1002], ['two changes straddling', {'changes': [[-6, 80], [6, 60]]}, 1062], ['three changes', {'changes': [[-6, 30], [4, 30], [7, 100]]}, 1120], ['change at year start', {'changes': [[0, 80]]}, 1038], ['change long before period', {'changes': [[-14, 100], [4, -50]]}, 961], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[6, -80]]}, 929]], [['single mid-year change', {'changes': [[8, 60]]}, 1056], ['change in prior year', {'changes': [[-3, -50]]}, 985], ['two changes straddling', {'changes': [[-7, 100], [2, 100]]}, 1071], ['three changes', {'changes': [[-11, -50], [0, -50], [10, 100]]}, 1070], ['change at year start', {'changes': [[0, 100]]}, 1048], ['change long before period', {'changes': [[-14, -50], [4, 30]]}, 1023], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[4, -80]]}, 937]], [['single mid-year change', {'changes': [[4, 80]]}, 1061], ['change in prior year', {'changes': [[-9, 60]]}, 1002], ['two changes straddling', {'changes': [[-4, 80], [8, 100]]}, 1112], ['three changes', {'changes': [[-2, 30], [2, 60], [8, 60]]}, 1108], ['change at year start', {'changes': [[0, 45]]}, 1022], ['change long before period', {'changes': [[-14, 30], [4, 60]]}, 1046], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[2, -80]]}, 946]], [['single mid-year change', {'changes': [[9, -50]]}, 951], ['change in prior year', {'changes': [[-5, -50]]}, 991], ['two changes straddling', {'changes': [[-8, 80], [5, -50]]}, 962], ['three changes', {'changes': [[-3, 80], [5, 30], [7, 60]]}, 1103], ['change at year start', {'changes': [[0, 100]]}, 1048], ['change long before period', {'changes': [[-14, 45], [4, 60]]}, 1046], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[4, -80]]}, 937]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
single mid-year change10701070Passed
change in prior year10091004Failed
two changes straddling974969Failed
three changes10231020Failed
change at year start10221022Passed
change long before period10701070Passed
no changes10001000Passed
rate decrease921921Passed

SHA-256 / 279bc731ad69dfa94b01b622f3c15ac6fcd4eee8485e444640e2cdb498521890

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(x):
    def after(m):
        d=Fraction(m,12)
        if d>=1: return Fraction(0)
        if d<=-1: return Fraction(1)
        if d>=0: return (1-d)**2/2
        return 1-(1+d)**2/2
    level=Fraction(1); levels=[level]
    for m,c in x['changes']:
        level*=1+Fraction(c,1000); levels.append(level)
    avg=Fraction(0)
    prev=Fraction(1)
    for i,(m,c) in enumerate(x['changes']):
        a=after(m)
        avg+=levels[i]*(prev-a)
        prev=a
    avg+=levels[-1]*prev
    return math.floor(levels[-1]/avg*1000+Fraction(1,2))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['single mid-year change', {'changes': [[3, 100]]}, 1070], ['change in prior year', {'changes': [[-7, 45]]}, 1004], ['two changes straddling', {'changes': [[-8, 45], [2, -50]]}, 969], ['three changes', {'changes': [[-9, 30], [3, 100], [8, -50]]}, 1020], ['change at year start', {'changes': [[0, 45]]}, 1022], ['change long before period', {'changes': [[-14, -50], [3, 100]]}, 1070], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[10, -80]]}, 921]], [['single mid-year change', {'changes': [[5, 60]]}, 1049], ['change in prior year', {'changes': [[-8, 30]]}, 1002], ['two changes straddling', {'changes': [[-6, 80], [6, 60]]}, 1062], ['three changes', {'changes': [[-6, 30], [4, 30], [7, 100]]}, 1120], ['change at year start', {'changes': [[0, 80]]}, 1038], ['change long before period', {'changes': [[-14, 100], [4, -50]]}, 961], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[6, -80]]}, 929]], [['single mid-year change', {'changes': [[8, 60]]}, 1056], ['change in prior year', {'changes': [[-3, -50]]}, 985], ['two changes straddling', {'changes': [[-7, 100], [2, 100]]}, 1071], ['three changes', {'changes': [[-11, -50], [0, -50], [10, 100]]}, 1070], ['change at year start', {'changes': [[0, 100]]}, 1048], ['change long before period', {'changes': [[-14, -50], [4, 30]]}, 1023], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[4, -80]]}, 937]], [['single mid-year change', {'changes': [[4, 80]]}, 1061], ['change in prior year', {'changes': [[-9, 60]]}, 1002], ['two changes straddling', {'changes': [[-4, 80], [8, 100]]}, 1112], ['three changes', {'changes': [[-2, 30], [2, 60], [8, 60]]}, 1108], ['change at year start', {'changes': [[0, 45]]}, 1022], ['change long before period', {'changes': [[-14, 30], [4, 60]]}, 1046], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[2, -80]]}, 946]], [['single mid-year change', {'changes': [[9, -50]]}, 951], ['change in prior year', {'changes': [[-5, -50]]}, 991], ['two changes straddling', {'changes': [[-8, 80], [5, -50]]}, 962], ['three changes', {'changes': [[-3, 80], [5, 30], [7, 60]]}, 1103], ['change at year start', {'changes': [[0, 100]]}, 1048], ['change long before period', {'changes': [[-14, 45], [4, 60]]}, 1046], ['no changes', {'changes': []}, 1000], ['rate decrease', {'changes': [[4, -80]]}, 937]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
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
single mid-year change10701070Passed
change in prior year10041004Passed
two changes straddling969969Passed
three changes10201020Passed
change at year start10221022Passed
change long before period10701070Passed
no changes10001000Passed
rate decrease921921Passed

SHA-256 / 955ae0b8d1af18c2c45ee5114cda871716060f5573910736e91a1fcc01c25b41

Verification & scope

A deterministic bounded teaching model of a stipulated toy rating contract. Amounts are integer cents and factors exact rationals; it makes no claim of conformance with any filed rating plan, bureau manual or jurisdiction. 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:47:10.221721+00:00.

Case digest / 46fe0fe7e0c5660eb964be5e57795e290cdee7f9b48fce056da19320f23a9e07