Saltar a contenido

Practical demo of simulated health claims triangles

This demo turns development triangle theory into a reproducible exercise. The goal is for the repository to work not only as a conceptual handbook, but also as a practical base for running models, validating assumptions, and showing results.

The Spanish output is the primary version for the Colombian context. This English version is included for bilingual use, documentation, teaching, and collaboration.

What the demo generates

The script generates:

  • observed long-format paid claims by origin year and development age;
  • paid incremental triangle;
  • paid cumulative triangle;
  • volume-weighted age-to-age factors;
  • ultimate and IBNR estimates by origin year;
  • execution summary;
  • SVG visualization of the traditional actuarial triangle.

The data are synthetic and do not represent real experience from any insurer, EPS, provider, benefit administrator, or specific portfolio.

From the repository root:

python scripts/generate_demo_triangles.py
python scripts/generate_demo_triangle_visuals.py

By default, two outputs are generated:

data/demo_triangulos/   # Spanish version
data/demo_triangles/    # English version

To generate only Spanish:

python scripts/generate_demo_triangles.py --language es

To generate only English:

python scripts/generate_demo_triangles.py --language en

English output files

data/demo_triangles/demo_health_paid_claims_long.csv
data/demo_triangles/paid_incremental_triangle.csv
data/demo_triangles/paid_cumulative_triangle.csv
data/demo_triangles/age_to_age_factors.csv
data/demo_triangles/chain_ladder_results.csv
data/demo_triangles/run_summary.txt
data/demo_triangles/paid_cumulative_triangle_actuarial_format.md
data/demo_triangles/paid_incremental_triangle_actuarial_format.md
docs/assets/demo_triangles/paid_cumulative_triangle.svg
docs/assets/demo_triangles/paid_incremental_triangle.svg

Traditional actuarial triangle visualization

In actuarial reserving, the most recognizable format is the triangle with origin years in rows and development ages in columns. Observed cells form a diagonal: older years have more observed development ages and recent years are less mature.

The demo generates this view for the cumulative paid triangle:

Paid cumulative triangle in actuarial format

It also generates the incremental version:

Paid incremental triangle in actuarial format

The practical reading is direct:

  • blue cells are available historical observations;
  • the green diagonal marks the latest available observation for each origin year;
  • gray cells represent unobserved future periods;
  • IBNR exists because the gray area must be estimated using development patterns.

Actuarial logic

The demo follows this flow:

  1. Simulate origin years.
  2. Assign exposure in member-months.
  3. Simulate frequency, severity, medical trend, and morbidity mix.
  4. Apply a cumulative paid emergence pattern.
  5. Generate observed payments up to the valuation year.
  6. Build incremental and cumulative triangles.
  7. Calculate volume-weighted age-to-age factors.
  8. Project ultimate using Chain Ladder.
  9. Calculate IBNR as ultimate minus observed cumulative paid.

Core formulas

For origin year \(i\) and development age \(j\), the selected age-to-age factor is:

\[ f_j = \frac{\sum_i C_{i,j+1}}{\sum_i C_{i,j}} \]

where:

  • \(C_{i,j}\) is cumulative paid for origin year \(i\) at development age \(j\);
  • the sum uses only origin years with available observations at both \(j\) and \(j+1\).

The cumulative development factor to ultimate for an origin year with latest observed age \(k\) is:

\[ CDF_k = \prod_{j=k}^{J-1} f_j \]

Ultimate and IBNR are estimated as:

\[ Ultimate_i = C_{i,k} \cdot CDF_k \]
\[ IBNR_i = Ultimate_i - C_{i,k} \]

Expected interpretation

Older origin years should be almost fully developed. More recent origin years should have a larger undeveloped share and, therefore, larger estimated IBNR.

This pattern demonstrates three core ideas:

  • the observed diagonal limits available information;
  • development factors transfer historical emergence into immature origin years;
  • IBNR increases when an origin year has lower observed maturity.

Limitations

This demo is intentionally simple:

  • it does not estimate uncertainty;
  • it does not calculate confidence intervals;
  • it does not include bootstrap;
  • it does not model denials, audit, recoveries, or administrative states;
  • it does not separate paid and incurred triangles;
  • it does not explicitly adjust for mix, contract, network, or regulatory changes.

These extensions remain open for future demos.