compute_chain_ladder
Project ultimate losses and estimate IBNR from a cumulative loss triangle using the chain-ladder method. Returns age-to-age factors, ultimates, and IBNR per accident year.
Instructions
Run a full chain-ladder reserving calculation on a cumulative loss triangle. This is the workhorse tool — call it whenever the user asks "what's the IBNR?", "what does the chain ladder say?", or hands you a triangle and asks for projections.
Args:
triangle: Cumulative loss triangle as a list of lists. Outer index
is the accident-year row (oldest first). Inner index is the
development period (0 = first age). Cells are numbers or null;
null means unobserved (typical lower-right corner of a real
triangle). All rows should be the same length — pad with
trailing nulls if needed.
selected_factors: Optional list of user-chosen age-to-age factors,
one per development-period transition (length = n_dev - 1).
When omitted, the volume-weighted factors derived from the
triangle are used as the selected set.
tail: Multiplicative tail factor applied beyond the last
development period. Default 1.0 (no tail).
excluded: List of [row_i, dev_j] pairs identifying individual
link ratios to drop from the volume and simple averages. Use
this for outlier handling — typically after consulting
mack_diagnostics to find suspect cells.
Returns:
A dictionary containing:
- volume_factors: list[float] — volume-weighted age-to-age
- simple_factors: list[float] — simple average of link ratios
- selected_factors: list[float] — the set actually used
- individual_factors: list[list[float | None]] — per-row link
ratios C[i, j+1] / C[i, j]; null where the pair is unobserved
- cdf: list[float] — cumulative dev factors to ultimate; last
element is tail
- latest_diagonal: list[float] — most recent observed value per
accident row
- ultimates: list[float] — projected ultimate per accident row
- ibnr: list[float] — Ultimate − Latest, per accident row
- total_latest, total_ultimate, total_ibnr: float scalars
- n_acc, n_dev: int — triangle dimensions for convenience
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| triangle | Yes | ||
| selected_factors | No | ||
| tail | No | ||
| excluded | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||