Chain ladder
chain_ladder_fit.RdProjects each origin's latest cumulative value to ultimate with
age-to-age factors estimated from the triangle and a tail factor. The
factors are Mack's weighted regressions: average = "volume" is the
volume-weighted chain-ladder factor (Mack's alpha = 1), "simple" the
mean of the link ratios (alpha = 0) and "regression" least squares
through the origin (alpha = 2). Results match R ChainLadder's
MackChainLadder() and chainladder-python
(validation/reference/reserving_chainladder_r.csv).
Usage
chain_ladder_fit(ptr)
chain_ladder(
triangle,
column = NULL,
average = "volume",
sigma_interpolation = "log-linear",
tail = 1,
ldf = NULL,
ldf_kind = NULL,
ldf_weight = 1,
ldf_origin = NULL,
ldf_underwriting = NULL,
n_periods = NULL,
drop_high = 0,
drop_low = 0,
development = NULL,
segment_map = NULL
)Arguments
- ptr
A
ChainLadderFitpointer; used internally.- triangle
A triangle, with any number of segments, or, for
chain_ladder(), a latest_valuation (a latest diagonal on its own).- column
Name of the column to fit; by default the only one. Not given for a latest valuation.
- average
"volume","simple","regression"or"geometric"."geometric"is the geometric mean of the link ratios: it gives the factors only, with no sigma or standard error, somack()and the bootstraps reject it.- sigma_interpolation
How a variance parameter that cannot be estimated (an age with a single link ratio) is filled in:
"log-linear"(regresslog(sigma)on age and extrapolate, the default of R ChainLadder) or"mack"(Mack 1993).- tail
Development past the oldest age: a number, the factor from the oldest age to ultimate (1 means no tail), or a
tail_constant(),tail_curve(),tail_bondy()ortail_log_linear().- ldf
A selected development pattern (above): a numeric vector named by age in months, or a data.frame with columns
ageandvalue.NULL(the default) estimates every factor. Ages off the triangle's (or latest valuation's) ages are read on the pattern's own ages,log(cdf)linear between them, and what the pattern gives past the oldest age folds into a constant tail at full weight (docs/design/reserving-v02.md, decision 18). Adding one off-grid age to a sparse age-to-age pattern changes how its other factors are read: each factor then runs to the pattern's next age, not the triangle's. On RAA,c("12" = 1.5, "18" = 1.1, "36" = 1.2)selects 1.5484 from 12 to 24 months, wherec("12" = 1.5, "36" = 1.2)selects 1.5; nothing warns of this.- ldf_kind
How
ldfis expressed:"ldf"(age-to-age factors),"cdf"(factors to ultimate) or"percent_developed", each finite and positive and in any order. Required withldf, since age-to-age factors and factors to ultimate cannot be told apart.- ldf_weight
The weight
won each selected factor, from 0 (the estimate) to 1 (the selection, the default): a number for every selected factor, or a numeric vector named by age (the age that starts the factor's link), the others fully selected.- ldf_origin
NULL(the default), or the grain ("M","Q","S"or"Y") of the origin periodsldfwas measured on, when it differs from the triangle's or latest valuation's: a pattern of accident months read for accident years, say. The pattern is averaged over the origin period with exposure even through it (SelectedPattern::averaged_over_origins), exact up to the pattern's end, with development deferred past it; a constant tail from the monthly pattern is the safer choice there. Equal to the target's grain, it changes nothing. It needs oneldf_weightfor every factor, not one by age, and the averaged pattern cannot be weighted by age from R. Withldf_underwritingit is the grain of the accident periodsldfis converted from instead.- ldf_underwriting
NULL(the default), or anunderwriting_basis()to whichldf, an accident-period pattern, is converted for the target's underwriting periods: an underwriting year's share developed at ageafrom its start issum_t e(t) p(a - t), witheits exposure by accident month andpan accident month's (SelectedPattern::to_underwriting_basis).ldfis on accident periods ofldf_origin, or of the target's origin grain without it: an accident-year pattern on underwriting-year origins needs noldf_origin. An accident-month pattern (ldf_origin = "M") converts under any writing and term; a pattern of longer accident periods needs a policy term that is a whole multiple of them or writing even within each of them. Given at every month from 1 it is exact; at other ages (annual ones, say) it is read between them as the basis'sreadingsays: by default the Weibull fitted through the period averages and corrected to the nearest monotone accident-month pattern whose averages are the given values exactly, within 0.2% of a simulated parallelogram book at every age, or by the rule above withreading = "ln-linear"(31% too much developed at 12 months on that book). The result runs pastldf's end by the writing months plus the policy term less the accident period (12 months for an accident-year pattern under the default, 23 for an accident-month one), and a constant tail fromldf's own tail is the safer choice there. The writing must be no longer than the target's origin period (the default's 12 months suit underwriting years only; on underwriting quarters giveunderwriting_basis(c(1, 1, 1))), or the fit is an error.- n_periods, drop_high, drop_low
Which link ratios the factor at each age averages.
n_periodskeeps the latestn_periodscalendar diagonals (NULL, the default, keeps every one; an age with fewer links uses all of them). Then thedrop_highhighest anddrop_lowlowest of the kept ratios are left out, except at an age where that would leave none. Whole numbers from 0 (n_periodsfrom 1); the defaults exclude nothing.mack(), the bootstraps and the one-year views accept them (the bootstraps and views keep the link ratios that the observed triangle keeps), andclaims_development_result()rejects any of them, even one that removes nothing. The fit'sn_linksandexcludedreport what was used.- development
For a latest_valuation only: a chain_ladder_fit (or a fit with
@chain_ladder) whose development projects each segment, asto_chain_ladder()freezes it. The method then takes noldf, notailother than 1 and no link ratio exclusions. The source's factors are read at each origin's own age, as fitted, with noldf_origin: a source fitted on another origin grain (accident quarters for a latest valuation of accident years, say) goes throughto_chain_ladder()instead, withldf_originadded to the arguments it returns, one segment at a time.- segment_map
With
development:NULLto take each segment's development from the source segment of the same label (a source of one segment serves every segment), or a named character vector from a segment of the latest valuation to one of the source, each label its key values joined by" / ".
Details
Every segment of the triangle is fitted on its own. Per-origin
properties run over the origins of each segment in turn, like the rows
of as.data.frame(), and are named by origin, or by "segment / origin" (key values joined by " / ") when there are several segments;
a single-segment fit has one value per origin.
Development past the oldest age is a tail: a given factor, or one
estimated by tail_constant(), tail_curve(), tail_bondy() or
tail_log_linear() (validation/reference/reserving_tails_python.csv
and reserving_tails_r.csv). A tail attached before the oldest age
replaces the estimated factors from there.
A selected development pattern (ldf, with ldf_kind and
ldf_weight) replaces, or blends with, the factors estimated from the
triangle at the ages it gives; the other ages stay estimated, so a
benchmark for the immature ages only is a partial pattern. Its values
are age-to-age factors (any ages but the oldest: development past it is
the tail's), or factors to ultimate or percents developed, which select
the factors between the first age and the last (cdf[a] / cdf[next age]); one factor to ultimate (or percent developed) is the tail from
its age, so it is given at the oldest age, with no tail and
ldf_weight 1, and on a triangle observed at one age it is the whole
projection. A development age they skip is interpolated: between
two given ages b < c, log(cdf) is linear in the age, so the factor
from a to the next age a' is (cdf[b] / cdf[c])^((a' - a) / (c - b))
(percents developed are converted to factors to ultimate first).
A cumulative pattern's level at its last age selects nothing. With no
tail (1) and a last age that is the oldest, the level is the tail: a
constant tail factor equal to the factor to ultimate there (1 over the
percent developed), with no parameter error, as chainladder-python's
DevelopmentConstant keeps it; pattern_tail reports it. Otherwise
the level is rescaled to the factors and tail in use, and
pattern_rescale reports the factor that multiplies the given percents
developed (and divides the given factors to ultimate) to reconcile the
level at the last age, so that a pattern given to the oldest age with a
tail, rescaled, times the tail is 100%.
At earlier ages the rescaled values are the projection's only where the
links are fully selected; with a blend, read cdf for the percents in
use. With a weight w, the factor used is
w * selected + (1 - w) * estimated. A selected factor at or after a
tail's attachment age is an error. In mack() and the bootstraps a
selected factor carries no parameter error and a blended one 1 - w
times the estimate's, while the process error stays the triangle's: a
supplied pattern lowers the reported uncertainty, and a wrong benchmark
is not reflected in it. Results match chainladder-python's
DevelopmentConstant (validation/reference/reserving_patterns_python.csv).
Properties of the fit, per origin: latest, ultimate, reserve; per
link (named "12-24" and so on): ldf (the selected factors, which the
projection uses: the estimated ones or a selected pattern's, replaced by
the tail's from its attachment age), estimated_ldf (the factors as
estimated, before a pattern or the tail replaced any), sigma (with
unestimable ones interpolated), std_err (of the factors used, 1 - ldf_weight times estimated_std_err), estimated_std_err,
selected_ldf (the pattern's age-to-age factors, NA where it selects
none), ldf_weight (0 where none is selected) and blended_ldf (the
factors before the tail); pattern_rescale (NULL for an age-to-age
pattern or none) and pattern_tail (the tail a cumulative pattern to
the oldest age implies with no tail; NULL otherwise); n_links (how many link ratios each factor averaged, after
the exclusions) and excluded (whether n_periods, drop_high or
drop_low left out a link ratio at some age); per age: cdf (age to ultimate, including the tail); the
tail: tail (the factor from the oldest age to ultimate),
tail_attachment_age (the age from which ldf holds the tail's
factors; the oldest age when it replaced none), tail_ldf (the factors
past the oldest age, which multiply to tail: one per development
period of the next year and one to ultimate, or a single one for
tail_log_linear()), tail_sigma and tail_std_err (the tail's
variance parameter and standard error, extrapolated log-linearly; 0
without a tail, a factor of 1; a tail below 1 is read where a tail of
1.001 would be, as chainladder-python does); and keys, index (one
row per segment, as a triangle's), origins, development, alpha (NaN
for the geometric average), total_ultimate and
total_reserve (summed over segments). The
per-link, per-age and tail properties need a single-segment fit: with
several segments use development_frame() (ldf, cdf, sigma and
std_err; the oldest age has the tail as its cdf), totals_frame()
(tail, tail_sigma and tail_std_err) or segment().
as.data.frame() gives one row per segment and origin, totals_frame()
one per segment.
Examples
long <- data.frame(year = c(2020, 2020, 2020, 2021, 2021, 2022),
age = c(12, 24, 36, 12, 24, 12),
paid = c(100, 150, 165, 110, 170, 120))
fit <- chain_ladder(triangle(long, "year", "age", "paid"), tail = 1.05)
fit@ldf
#> 12-24 24-36
#> 1.52381 1.10000
fit@reserve
#> 2020 2021 2022
#> 8.25 26.35 91.20
fit@total_reserve
#> [1] 125.8
chain_ladder(triangle(long, "year", "age", "paid"), tail = tail_bondy())@tail
#> [1] 1.1
# Every line of business at once.
by_lob <- rbind(transform(long, lob = "auto"), transform(long, lob = "home", paid = paid / 2))
fits <- chain_ladder(triangle(by_lob, "year", "age", "paid", keys = "lob"))
fits@reserve
#> auto / 2020 auto / 2021 auto / 2022 home / 2020 home / 2021 home / 2022
#> 0.00000 17.00000 81.14286 0.00000 8.50000 40.57143
as.data.frame(fits)
#> lob origin latest ultimate reserve
#> 1 auto 2020 165.0 165.0000 0.00000
#> 2 auto 2021 170.0 187.0000 17.00000
#> 3 auto 2022 120.0 201.1429 81.14286
#> 4 home 2020 82.5 82.5000 0.00000
#> 5 home 2021 85.0 93.5000 8.50000
#> 6 home 2022 60.0 100.5714 40.57143
totals_frame(fits)
#> lob latest ultimate reserve tail tail_sigma tail_std_err
#> 1 auto 455.0 553.1429 98.14286 1 0 0
#> 2 home 227.5 276.5714 49.07143 1 0 0
# A benchmark for the immature ages only: 50% developed at 12 months and
# 80% at 24 select the factor 1.6 from 12 to 24; 24 to 36 stays estimated.
bench <- chain_ladder(triangle(long, "year", "age", "paid"),
ldf = c("12" = 0.5, "24" = 0.8), ldf_kind = "percent_developed")
bench@ldf
#> 12-24 24-36
#> 1.6 1.1
bench@estimated_ldf
#> 12-24 24-36
#> 1.52381 1.10000
bench@pattern_rescale
#> [1] 1.136364
# Half credibility on the benchmark.
chain_ladder(triangle(long, "year", "age", "paid"), ldf = c("12" = 0.5, "24" = 0.8),
ldf_kind = "percent_developed", ldf_weight = 0.5)@ldf
#> 12-24 24-36
#> 1.561905 1.100000