Skip to content

[Data] Add actsim_sample: synthetic multi-D monthly triangle (#1218) - #1425

Draft
jzhng105 wants to merge 2 commits into
mainfrom
1218-sample-triangles
Draft

jzhng105 wants to merge 2 commits into
mainfrom
1218-sample-triangles

Conversation

@jzhng105

@jzhng105 jzhng105 commented Sep 23, 2026

Copy link
Copy Markdown

Adds actsim_sample, a synthetic incremental OMDM triangle with a two-level index, for testing and demonstrating multi-D / multi-grain workflows. All other grains are available via .grain() (e.g. OQDQ, OYDY) and 2-D/3-D views via .sum() / .groupby().

Shape: (9, 2, 120, 120)
Index: Region x LOB
Region: New_York, Chicago, Atlanta
LOB: COLL (collision), TPL_BI (third-party BI), AB (accident benefits)
Columns: reportedCount, Incurred (incremental)
Origin: monthly, 2016-01 to 2025-12; valuation 2025-12-31

Generated with ActSim (ClaimSimulator), seeds 1000-1008 (one per segment).

Exposure / frequency

  • One annual-term policy cohort written each month, 2015-01 to 2025-12, 100 policies per cohort per region.
  • Claim counts per cohort ~ Poisson(100 x freq): COLL 0.11 (lambda = 11), TPL_BI 0.010 (lambda = 1.0), AB 0.007 (lambda = 0.7)
  • Accident dates uniform within the policy term (NHPP with alpha = 0); claims from accidents before 2016-01-01 are dropped.

Severity (lognormal, mu/sigma of log-loss, at 2016 level)

  • COLL (8.3, 0.75): mean ~5.3k
  • TPL_BI (9.9, 1.15): mean ~38.6k
  • AB (10.2, 1.45): mean ~77.0k
  • Trend: mu + 0.05 per accident year (~5.1% p.a. severity inflation).

Development (per-claim age-to-age factors keyed by development month, each perturbed by N(1, 0.10))

  • COLL: {0: 1.6, 1: 1.3, 2: 1.05, 3: 1.0} ultimate by month 3
  • TPL_BI: {3: 2.0, 12: 1.5, 24: 1.15, 36: 1.05, 48: 1.0} ultimate by month 48
  • AB: {3: 2.3, 12: 1.8, 24: 1.4, 48: 1.15, 72: 1.05, 96: 1.0} ultimate by month 96
  • reportedCount is recorded at each claim's first development age.

Known characteristics

  • Incurred only moves at the keyed ages, so the TPL_BI and AB rows change in steps rather than every month.
  • Multiplicative LDF noise produces some small negative incremental incurred amounts, mostly at the final development age.
  • All figures are fictional.

Summary of Changes

Added actsim_sample, a synthetic incremental OMDM triangle with a two-level index, for testing and demonstrating multi-D / multi-grain workflows. All other grains are available via .grain() (e.g. OQDQ, OYDY) and 2-D/3-D views via .sum() / .groupby().

Related GitHub Issue(s)

ISSUE #1218 closed

AI/LLM Usage

Additional Context for Reviewers

Submitter's Checklist

  • I have reviewed and am adhering to the standards outlined in the project Governing Doc.
  • The PR subject title summarizes the changes, with one proper prefix ([FIX], [FEAT], [DOCS], [TST], [CHORE], or [BRK]).
  • I am a human (not a bot), and this PR form is written by a human.

Reviewer's Checklist

  • The implementation addresses the associated issue(s).
  • The implementation is appropriate, maintainable, and follows ARCHITECTURE.md.
  • PR subject title has the proper prefix and the subject is appropriate.
  • Relevant issue(s) are linked.
  • AI/LLM usage is disclosed and appropriate.
  • Documentation and tests are appropriate.
  • CI tests passed, or any failures are acceptable.
  • Leave a comment with the final recommendation (e.g. approve as is, request a secondary review, or flag an area for more review).

Adds `actsim_sample`, a synthetic incremental OMDM triangle with a
two-level index, for testing and demonstrating multi-D / multi-grain
workflows. All other grains are available via `.grain()` (e.g. OQDQ,
OYDY) and 2-D/3-D views via `.sum()` / `.groupby()`.

Shape: (9, 2, 120, 120)
  Index:   Region x LOB
           Region: New_York, Chicago, Atlanta
           LOB:    COLL (collision), TPL_BI (third-party BI), AB (accident benefits)
  Columns: reportedCount, Incurred (incremental)
  Origin:  monthly, 2016-01 to 2025-12; valuation 2025-12-31

Generated with ActSim (ClaimSimulator), seeds 1000-1008 (one per segment).

Exposure / frequency
  - One annual-term policy cohort written each month, 2015-01 to 2025-12,
    100 policies per cohort per region.
  - Claim counts per cohort ~ Poisson(100 x freq):
      COLL 0.11 (lambda = 11), TPL_BI 0.010 (lambda = 1.0), AB 0.007 (lambda = 0.7)
  - Accident dates uniform within the policy term (NHPP with alpha = 0);
    claims from accidents before 2016-01-01 are dropped.

Severity (lognormal, mu/sigma of log-loss, at 2016 level)
  - COLL   (8.3, 0.75): mean ~5.3k
  - TPL_BI (9.9, 1.15): mean ~38.6k
  - AB    (10.2, 1.45): mean ~77.0k
  - Trend: mu + 0.05 per accident year (~5.1% p.a. severity inflation).

Development (per-claim age-to-age factors keyed by development month,
each perturbed by N(1, 0.10))
  - COLL:   {0: 1.6, 1: 1.3, 2: 1.05, 3: 1.0}     ultimate by month 3
  - TPL_BI: {3: 2.0, 12: 1.5, 24: 1.15, 36: 1.05, 48: 1.0}    ultimate by month 48
  - AB:     {3: 2.3, 12: 1.8, 24: 1.4, 48: 1.15, 72: 1.05, 96: 1.0}  ultimate by month 96
  - reportedCount is recorded at each claim's first development age.

Known characteristics
  - Incurred only moves at the keyed ages, so the TPL_BI and AB rows
    change in steps rather than every month.
  - Multiplicative LDF noise produces some small negative incremental
    incurred amounts, mostly at the final development age.
  - All figures are fictional.
@github-actions

github-actions Bot commented Sep 23, 2026

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 15.6% of exported symbols fully typed (221 / 1420)

Known Ambiguous Unknown Total
Project (head) 221 108 1091 1420

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 326
  • Functions without default param: 0
  • Classes without docstring: 8

Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected.

@kennethshsu
kennethshsu marked this pull request as draft September 23, 2026 13:53
@kennethshsu

Copy link
Copy Markdown
Member

@jzhng105 please complete the PR template and resolve CICD checks

@henrydingliu

Copy link
Copy Markdown
Member

instructions for adding new datasets is here.

https://github.com/casact/chainladder-python/blob/main/chainladder/utils/data/_manifest.py

two-level index, in chainladder/utils/data/_manifest.py
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.59%. Comparing base (e4e0695) to head (8390fe3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1425   +/-   ##
=======================================
  Coverage   92.59%   92.59%           
=======================================
  Files         102      102           
  Lines        5846     5846           
  Branches      723      723           
=======================================
  Hits         5413     5413           
  Misses        312      312           
  Partials      121      121           
Flag Coverage Δ
unittests 92.59% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jzhng105

Copy link
Copy Markdown
Author

Checked off the lists and registered the sample data in manifest

@jzhng105
jzhng105 marked this pull request as ready for review September 24, 2026 03:03
@kennethshsu

Copy link
Copy Markdown
Member

@jzhng105 sorry, are you sure you read the checklist? PR template prefix in this case should be [FEAT], can you update that please?

For the future, please also fill out the AI/LLM Usage portion. I think we are ok for this one as I understand the data is completely synthetic.

"columns": ["values"],
"cumulative": True,
},
"actsim_sample": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use actsim here and drop the sample so everything looks a bit more uniformed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the csv filename too! Thanks @jzhng105!!

@kennethshsu
kennethshsu marked this pull request as draft September 24, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants