reserving.ChainLadderFit

A fitted chain-ladder projection of every segment of a triangle column.

Usage

reserving.ChainLadderFit()

Per-origin lists (origins, latest, ultimate, reserve) run over the origins of each segment in turn, like the rows of to_frame(), so a single-segment fit has one value per origin. Per-age lists (ldf, cdf, sigma, std_err) and the tail need a single-segment fit; for several segments use development_frame() (per age), totals_frame() (tail, tail_sigma, tail_std_err) or segment(...).

Examples

>>> from prospicio.reserving import ChainLadder, Triangle
>>> tri = Triangle.from_long(
...     [2020, 2020, 2021] * 2,
...     [12, 24, 12] * 2,
...     {"paid": [100.0, 150.0, 200.0, 10.0, 20.0, 30.0]},
...     keys={"lob": ["Auto"] * 3 + ["Home"] * 3},
... )
>>> fit = ChainLadder().fit(tri, "paid")
>>> fit.index, fit.reserve

([‘Auto’, ‘Home’], [0.0, 100.0, 0.0, 30.0])

>>> fit.segment(lob="Home").ldf

[2.0]

Attributes

Name Description
cdf Age-to-ultimate factors, one per age, including the tail.
development Development ages in months.
estimated_ldf Age-to-age factors as estimated, before the tail replaced any.
index Label of each segment, as Triangle.index.
keys Names of the triangle’s key columns; empty without keys.
latest Latest observed cumulative value per origin.
ldf Selected age-to-age factors, which the projection uses: the
origins Origin period of each per-origin value.
reserve Reserve (ultimate minus latest) per origin.
sigma Variance parameter of each factor, with unestimable ones
std_err Standard error of each factor.
tail Tail factor from the oldest age to ultimate.
tail_attachment_age Age from which ldf holds the tail’s factors rather than the
tail_ldf Factors past the oldest age, which multiply to tail: one per
tail_sigma The tail’s variance parameter, extrapolated log-linearly; 0 without
tail_std_err Standard error of the tail factor, extrapolated log-linearly.
total_reserve Total reserve across segments and origins.
total_ultimate Total ultimate across segments and origins.
ultimate Projected ultimate per origin.

cdf

Age-to-ultimate factors, one per age, including the tail.

cdf: list[float]


development

Development ages in months.

development: list[int]


estimated_ldf

Age-to-age factors as estimated, before the tail replaced any.

estimated_ldf: list[float]


index

Label of each segment, as Triangle.index.

index: list[Any]


keys

Names of the triangle’s key columns; empty without keys.

keys: list[str]


latest

Latest observed cumulative value per origin.

latest: list[float]


ldf

Selected age-to-age factors, which the projection uses: the

ldf: list[float]

estimated ones, replaced by the tail’s from its attachment age. Factor k links age k to k + 1.


origins

Origin period of each per-origin value.

origins: list[str]


reserve

Reserve (ultimate minus latest) per origin.

reserve: list[float]


sigma

Variance parameter of each factor, with unestimable ones

sigma: list[float]

interpolated (nan where that is impossible).


std_err

Standard error of each factor.

std_err: list[float]


tail

Tail factor from the oldest age to ultimate.

tail: float


tail_attachment_age

Age from which ldf holds the tail’s factors rather than the

tail_attachment_age: int

estimated ones; the oldest age when the tail replaced none.


tail_ldf

Factors past the oldest age, which multiply to tail: one per

tail_ldf: list[float]

development period of the following year and one to ultimate, as chainladder-python’s ldf_ (a single factor for TailLogLinear).


tail_sigma

The tail’s variance parameter, extrapolated log-linearly; 0 without

tail_sigma: float

a tail (a factor of 1), nan if it cannot be extrapolated. A tail below 1 is read where a tail of 1.001 would be, as chainladder-python does.


tail_std_err

Standard error of the tail factor, extrapolated log-linearly.

tail_std_err: float


total_reserve

Total reserve across segments and origins.

total_reserve: float


total_ultimate

Total ultimate across segments and origins.

total_ultimate: float


ultimate

Projected ultimate per origin.

ultimate: list[float]

Methods

Name Description
development_frame() One row per segment and age: the key columns, development,
segment() The fit of one segment, chosen by key values (compared as str()
to_frame() One row per segment and origin: the key columns, origin,
totals_frame() One row per segment: the key columns, the segment’s total

development_frame()

One row per segment and age: the key columns, development,

Usage

development_frame()

ldf (the selected factor to the next age), cdf (to ultimate, with the tail), sigma and std_err; the oldest age has nan for ldf, sigma and std_err, and the tail factor as its cdf. Needs pandas.

Returns
pandas.DataFrame

segment()

The fit of one segment, chosen by key values (compared as str()

Usage

segment(**keys)

of each value). Keys not named may take any value, so a fit with one segment needs none.

Returns
ChainLadderFit
Raises
ValueError
If a key or value is unknown, or the choice matches several segments.

to_frame()

One row per segment and origin: the key columns, origin,

Usage

to_frame()

latest, ultimate and reserve. Needs pandas.

Returns
pandas.DataFrame

totals_frame()

One row per segment: the key columns, the segment’s total

Usage

totals_frame()

latest, ultimate and reserve, and its tail, tail_sigma and tail_std_err. Needs pandas.

Returns
pandas.DataFrame