Skip to main content

reserving.MackFit

A fitted Mack model of every segment: the chain-ladder fields, plus

Usage

Source

reserving.MackFit()

standard errors of each origin’s reserve and of each segment’s total.

Per-origin lists run over the origins of each segment in turn, like the rows of to_frame(). Per-age lists, the tail and the totals’ standard errors need a single-segment fit; for several segments use development_frame(), totals_frame() (the totals’ standard errors and the tail) or segment(...). total_ultimate and total_reserve sum over every segment.

Attributes

Name Description
blended_ldf The factors before the tail, as ChainLadderFit.blended_ldf.
cdf Age-to-ultimate factors, including the tail.
cdr Merz and Wüthrich’s one-year view, as a property: the same
chain_ladder The underlying chain-ladder projection.
development Development ages in months.
estimated_ldf Factors as estimated, as ChainLadderFit.estimated_ldf.
estimated_std_err Standard error of each estimated factor, as
excluded Whether n_periods or the drops left out a link ratio at some age.
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, as ChainLadderFit.ldf.
ldf_weight The weight on each link’s selected factor, as
n_links Number of link ratios behind each estimated factor, as
origins Origin period of each per-origin value.
parameter_risk Parameter (estimation) standard error per origin.
pattern_rescale The rescale of a cumulative pattern, as
pattern_tail The tail a cumulative pattern implies, as
process_risk Process standard error per origin.
reserve Reserve per origin.
selected_ldf The selected pattern’s factor of each link, as
sigma Variance parameter of each factor.
standard_error Mack standard error per origin: sqrt(process**2 + parameter**2).
std_err Standard error of each factor used before the tail, as
tail Tail factor from the oldest age to ultimate.
tail_attachment_age Age from which ldf holds the tail’s factors, as
tail_ldf Factors past the oldest age, as ChainLadderFit.tail_ldf.
tail_sigma The tail’s sigma used in the process risk: given, or extrapolated
tail_std_err The tail factor’s standard error used in the parameter risk: given,
total_cv Coefficient of variation of the total reserve.
total_parameter_risk Parameter standard error of the total reserve, including the
total_process_risk Process standard error of the total reserve.
total_reserve Total reserve across segments and origins.
total_standard_error Mack standard error of the total reserve.
total_ultimate Total ultimate across segments and origins.
ultimate Projected ultimate per origin.

blended_ldf

The factors before the tail, as ChainLadderFit.blended_ldf.

blended_ldf: list[float]


cdf

Age-to-ultimate factors, including the tail.

cdf: list[float]


cdr

Merz and Wüthrich’s one-year view, as a property: the same

cdr: ClaimsDevelopmentResult

ClaimsDevelopmentResult that claims_development_result() returns (that method stays as an alias), named as OneYearFit.cdr names the claims development result. This one holds the analytic standard errors; OneYearFit.cdr is the simulated distribution.

Raises

chain_ladder

The underlying chain-ladder projection.

chain_ladder: ChainLadderFit


development

Development ages in months.

development: list[int]


estimated_ldf

Factors as estimated, as ChainLadderFit.estimated_ldf.

estimated_ldf: list[float]


estimated_std_err

Standard error of each estimated factor, as

estimated_std_err: list[float]


excluded

Whether n_periods or the drops left out a link ratio at some age.

excluded: bool


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, as ChainLadderFit.ldf.

ldf: list[float]


ldf_weight

The weight on each link’s selected factor, as

ldf_weight: list[float]



origins

Origin period of each per-origin value.

origins: list[str]


parameter_risk

Parameter (estimation) standard error per origin.

parameter_risk: list[float]


pattern_rescale

The rescale of a cumulative pattern, as

pattern_rescale: float | None


pattern_tail

The tail a cumulative pattern implies, as

pattern_tail: float | None


process_risk

Process standard error per origin.

process_risk: list[float]


reserve

Reserve per origin.

reserve: list[float]


selected_ldf

The selected pattern’s factor of each link, as

selected_ldf: list[float | None]


sigma

Variance parameter of each factor.

sigma: list[float]


standard_error

Mack standard error per origin: sqrt(process**2 + parameter**2).

standard_error: list[float]


std_err

Standard error of each factor used before the tail, as

std_err: list[float]

ChainLadderFit.std_err: the parameter risk’s.


tail

Tail factor from the oldest age to ultimate.

tail: float


tail_attachment_age

Age from which ldf holds the tail’s factors, as

tail_attachment_age: int


tail_ldf

Factors past the oldest age, as ChainLadderFit.tail_ldf.

tail_ldf: list[float]


tail_sigma

The tail’s sigma used in the process risk: given, or extrapolated

tail_sigma: float

log-linearly; 0 without a tail (a factor of 1).


tail_std_err

The tail factor’s standard error used in the parameter risk: given,

tail_std_err: float

or extrapolated log-linearly; 0 without a tail (a factor of 1).


total_cv

Coefficient of variation of the total reserve.

total_cv: float


total_parameter_risk

Parameter standard error of the total reserve, including the

total_parameter_risk: float

correlation between origins that share estimated factors.


total_process_risk

Process standard error of the total reserve.

total_process_risk: float


total_reserve

Total reserve across segments and origins.

total_reserve: float


total_standard_error

Mack standard error of the total reserve.

total_standard_error: float


total_ultimate

Total ultimate across segments and origins.

total_ultimate: float


ultimate

Projected ultimate per origin.

ultimate: list[float]

Methods

Name Description
calendar_year_effect() Mack’s calendar-year effect test (Mack 1994, appendix H; R
claims_development_result() Merz and Wüthrich’s (2008) one-year view: the standard error of the
development_correlation() Mack’s test for correlation between adjacent development factors
development_frame() One row per segment and age, as ChainLadderFit.development_frame.
discounted() The unpaid claims discounted simulation by simulation, by origin and
from_json() A fit from a document written by to_json.
segment() The fit of one segment, chosen by key values as
to_frame() One row per segment and origin: the key columns, origin,
to_json() This fit, every segment, as a JSON document that from_json reads
totals_frame() One row per segment: the key columns, the segment’s total

calendar_year_effect()

Mack’s calendar-year effect test (Mack 1994, appendix H; R

Usage

Source

calendar_year_effect(ci=...)

ChainLadder’s cyEffTest) on the link ratios this fit averaged: its column’s, without those n_periods, drop_high and drop_low exclude. A selected pattern (ldf) changes no link ratio and so not the test (docs/design/reserving-v02.md, decision 27).

Parameters
ci: float = 0.95
The interval’s confidence level, Mack’s and R’s 95%.
Returns
CalendarYearTest
Raises
ValueError
If the fit has several segments (use segment(...)), ci is not strictly between 0 and 1, or no calendar diagonal has two link ratios.

claims_development_result()

Merz and Wüthrich’s (2008) one-year view: the standard error of the

Usage

Source

claims_development_result()

claims development result of each origin and in total, in the next calendar year and in every later one, as R ChainLadder’s CDR(MackChainLadder(x), dev = "all").

The method form of the cdr property, kept as its alias.

With a selected pattern (Mack(ldf=...)), each factor used varies with 1 - w times the estimate’s parameter error, so a fully selected link adds process error only; with weights strictly between 0 and 1 the calendar years’ CDRs are correlated, and their standard errors need not add up to Mack’s (docs/design/reserving-v02.md, decision 12).

Returns
ClaimsDevelopmentResult
Raises
ValueError
If the fit has several segments (use segment(...)), the factors are not volume-weighted, the fit has a tail (a factor other than 1, or one that replaces estimated factors), the fit excludes link ratios (n_periods, drop_high or drop_low; use MackBootstrap.one_year, which follows them), or the latest values do not lie on one calendar diagonal with one new origin per period.

development_correlation()

Mack’s test for correlation between adjacent development factors

Usage

Source

development_correlation(ci=...)

(Mack 1994, appendix G; R ChainLadder’s dfCorTest) on the link ratios this fit averaged, as calendar_year_effect reads them.

Parameters
ci: float = 0.5
The interval’s confidence level, Mack’s and R’s 50%.
Returns
DevelopmentCorrelationTest
Raises
ValueError
If the fit has several segments (use segment(...)), ci is not strictly between 0 and 1, or no pair of adjacent link columns has two origins in common and untied ranks.

development_frame()

One row per segment and age, as ChainLadderFit.development_frame.

Usage

Source

development_frame()

Needs pandas.

Returns
pandas.DataFrame

discounted()

The unpaid claims discounted simulation by simulation, by origin and

Usage

Source

discounted(
    *,
    basis,
    rate=None,
    curve=None,
    timing="mid",
    paid_pattern=None,
    latest_paid=None
)

in total, for the IFRS 17 liability for incurred claims and its risk adjustment (DiscountedReserves, docs/design/reserving-ifrs17.md).

Analytic Mack has no simulations to discount: this raises NotSupportedError; discount a MackBootstrap fit instead.

Parameters
basis: (paid, incurred) = "paid"

What the fit’s column is, stated by the caller (no default), so that a fit on incurred claims is not discounted by its reporting pattern by mistake. "paid" pays each simulation’s reserve along that simulation’s own pattern. "incurred" pays each reserve (the IBNR) plus the origin’s case reserve (its latest incurred less latest_paid) along paid_pattern.

rate: float = None

A flat annual effective rate. Give rate or curve.

curve: DiscountCurve = None

Spot rates by maturity.

timing: (mid, end) = "mid"

Payments at the middle or the end of each development period.

paid_pattern: list of float = None

For basis="incurred": the cumulative paid share at each of the fit’s pattern ages (with the tail’s age when the fit has a tail), ending at 1.

latest_paid: list of float = None
For basis="incurred": each origin’s latest paid, one per component of reserves in their order.
Returns
DiscountedReserves

from_json()

A fit from a document written by to_json.

Usage

Source

from_json(text)
Parameters
text: str
Returns
MackFit
Raises
ValueError
If the text is not such a document, or is from a newer version.

segment()

The fit of one segment, chosen by key values as

Usage

Source

segment(**keys)
Returns
MackFit

to_frame()

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

Usage

Source

to_frame()
Returns
pandas.DataFrame

to_json()

This fit, every segment, as a JSON document that from_json reads

Usage

Source

to_json()

back exactly: every number bit for bit, the link ratios that the assumption tests read included. Pickling uses it too.

Returns
str
Examples
>>> import pickle
>>> from prospicio.reserving import Mack, MackFit, Triangle
>>> tri = Triangle.from_long(
...     origin=[2020] * 4 + [2021] * 3 + [2022] * 2 + [2023],
...     development=[12, 24, 36, 48, 12, 24, 36, 12, 24, 12],
...     values={"paid": [100.0, 150.0, 165.0, 170.0, 110.0, 172.0, 185.0,
...                      120.0, 175.0, 130.0]})
>>> fit = Mack().fit(tri, "paid")
>>> MackFit.from_json(fit.to_json()).standard_error == fit.standard_error

True

>>> pickle.loads(pickle.dumps(fit)).to_json() == fit.to_json()

True


totals_frame()

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

Usage

Source

totals_frame()

latest, ultimate and reserve, and the process_risk, parameter_risk and standard_error of its total reserve. Needs pandas.

Returns
pandas.DataFrame