A growth curve fitted to a benchmark pattern
benchmark_curve_fit.RdFits Clark's log-logistic or Weibull growth curve G to a benchmark
pattern by weighted least squares on the percents developed (issue #637;
design note docs/design/reserving-v02.md, decision 23). The fit gives
the pattern at any age, a smooth pattern between the benchmark's ages and
a tail past its last. The parameters match scipy.optimize.least_squares
(validation/tests/reserving_benchmark_curve.rs).
Arguments
- ptr
A
BenchmarkCurveFitpointer; used internally.- pattern
The benchmark: a named numeric vector (names are ages in months, any positive numbers) of percents developed or factors to ultimate, each finite and positive; at least two ages.
- kind
"percent_developed"or"cdf"(factors to ultimate). Age-to-age factors give no level to fit.- curve
The growth curve:
"loglogistic",G(x) = x^omega / (x^omega + theta^omega), or"weibull",G(x) = 1 - exp(-(x / theta)^omega).- weights
NULLfor weight 1 at every age, or a named numeric vector (names are ages ofpattern; an age not named gets 1) of weights, finite and not negative, on the squared residuals.- max_age
Age in months at which development stops, so the pattern is 100% there, at least the benchmark's last age;
Inf(orNULL) develops to infinity. A benchmark that reaches 100% needs it.- origin_width
NULLto measure the curve's ages from the start of the origin period, or the origin period's length in months (12 for accident years) to measure them from its middle, asclark_ldf().- fit
A
benchmark_curve_fit.- age, ages
Development ages in months;
benchmark_selected()'s are whole, positive and each given once.
Value
benchmark_curve(): a benchmark_curve_fit.
benchmark_percent_developed() and benchmark_cdf(): a numeric
vector, one value per age. benchmark_selected(): a list of ldf,
ldf_kind and ldf_weight.
Details
The fitted percent developed at age a is G(c(a)) / G(c(max_age))
(G(c(max_age)) = 1 for max_age = Inf), as clark_ldf() develops a
latest value. Benchmark ages are development ages in months from the
start of the origin period, as a triangle's; c(a) is the age itself, or
with origin_width set Clark's age from the average date of loss,
a - w / 2 at or past the width w and a / 2 before it.
benchmark_curve()fits the curve. The properties of abenchmark_curve_fitarecurve,omega,theta,max_age,origin_width(NULLwithout the shift), and by benchmark age, in increasing order,ages,observed(the percents developed),weights,fittedandresiduals(observed - fitted), andsum_of_squares, the weighted sum of squared residuals.benchmark_percent_developed()andbenchmark_cdf()give the fitted percent developed and factor to ultimate at any development ages.benchmark_selected()gives the fitted pattern at whole development ages as theldf,ldf_kindandldf_weightarguments ofchain_ladder(),mack()and the expected-loss methods:do.call(chain_ladder, c(list(triangle), benchmark_selected(fit, ages))). Give the method notail: with ages ending at the triangle's oldest, the pattern's level there is the tail,benchmark_cdf(fit, oldest).
These are Python's BenchmarkCurve and BenchmarkCurveFit.
Examples
bench <- c("12" = 0.30, "24" = 0.62, "36" = 0.80, "48" = 0.89, "60" = 0.94)
fit <- benchmark_curve(bench)
c(omega = fit@omega, theta = fit@theta)
#> omega theta
#> 2.09842 18.40341
fit@residuals
#> 12 24 36 48 60
#> 0.010403760 -0.015797058 -0.003450981 0.007981816 0.017277117
benchmark_percent_developed(fit, c(18, 30, 120))
#> [1] 0.4883747 0.7360264 0.9808186
long <- data.frame(year = rep(2020:2022, 3:1), age = c(12, 24, 36, 12, 24, 12),
paid = c(100, 150, 165, 110, 170, 120))
tri <- triangle(long, "year", "age", "paid")
cl <- do.call(chain_ladder, c(list(tri), benchmark_selected(fit, c(12, 24, 36))))
cl@ultimate
#> 2020 2021 2022
#> 205.3641 267.3809 414.3700