One-year view of the Bayesian Bornhuetter-Ferguson
bayes_bf_one_year.RdThe claims development result (CDR) over the coming year of
bayes_bf(), by Pareto smoothed importance sampling of the posterior
(decisions 16 and 17 of docs/design/reserving-bayes.md), exactly as
bayes_odp_one_year() with this model's means mu[w] * gamma[d].
bayes_bf_one_year() fits the posterior and the lifetime reserves as
bayes_bf() does with the same settings. Each simulation draws the
year's increments from a posterior draw with process error, reweights
every posterior draw by the year's quasi likelihood (the scale, the
priors and the prior ultimates unchanged), and takes each origin's CDR as
its posterior mean reserve at the opening less its payment in the year
and its weighted posterior mean reserve after it; a simulation whose
Pareto k is above k_threshold is moment-matched and, if that cannot
rescue it, refitted with NUTS, as refit says.
Usage
bayes_bf_one_year(
triangle,
column,
exposure,
apriori = 1,
cv = 0.1,
development_sd = 10,
process = c("gamma", "none"),
chains = 4,
tune = 1000,
draws = 1000,
n_sims = 10000,
seed = 0,
target_accept = 0.95,
max_depth = 10,
k_threshold = 0.7,
refit = c("moment_match_then_refit", "refit_flagged", "reweight_only", "refit_all"),
max_refits = NULL,
one_year_sims = NULL
)Arguments
- triangle
A cumulative triangle with one segment, every origin observed from the first age up to its latest.
- column
Name of the loss column to fit.
- exposure
Name of the exposure column; each origin's latest observed value is its exposure, as for
bornhuetter_ferguson().- apriori
Prior mean of each origin's
mu[w]per unit of exposure. It is the expected loss ratio only when the patterngammasums to 1 (Details).- cv
Coefficient of variation of the gamma prior on each
mu[w](shape1 / cv^2, EVW'sa);Inffor a flat prior.- development_sd
Standard deviation of the normal prior on each
log gamma[d], centred on 0. Withcv = Inf, a much vaguer prior (1,000, say) leaves divergent transitions.- process
Process error on each simulated future increment:
"gamma"(meanmu, variancephi * mu) or"none"for parameter error only.- chains, tune, draws
NUTS chains, warm-up draws per chain and kept draws per chain.
- n_sims
Number of predictive simulations, independent of the number of posterior draws; positive.
- seed
Seed of the chains and of the simulations, a non-negative whole number.
- target_accept
Target mean acceptance rate of the step-size adaptation.
- max_depth
Largest NUTS tree depth.
- k_threshold
The Pareto k above which a simulation's importance weights are not trusted (the threshold of Vehtari et al. 2024 for a few thousand draws).
- refit
What happens to a flagged simulation:
"moment_match_then_refit"(the default) moves the posterior draws by affine maps to the moments the weights estimate (moment matching, asloo::loo_moment_match()), refitting only a simulation whose k stays abovek_threshold;"refit_flagged"refits it with NUTS;"reweight_only"reweights it anyway (fast, biased where k is high);"refit_all"refits every simulation, to check the reweighting.- max_refits
The most simulations refitted with NUTS: the first this many due for a refit, in simulation order; the others are reweighted as they are (as unreliable as their k says), listed in
unrefittedand warned about.NULL(the default) refits every one,0none. In the_segmentsfunctions it applies to each segment, so k segments refit at most k times this many.- one_year_sims
The number of one-year simulations, or
NULL(the default) for the model's one-year default:n_simsforbayes_odp_one_year()andbayes_bf_one_year(), andn_simscapped at 2,000 formeyers_one_year(). The lifetime reserves keepn_sims. A smaller count gives the first simulations of a larger one.
Details
The prior's strength moves the view between two limits. A flat prior
(cv = Inf) is the Bayesian chain ladder: on GenIns its CDR's
standard deviation agrees with bayes_odp_one_year()'s within Monte
Carlo error. A tight prior fixes each origin's level, so only the
development pattern learns from the year: on GenIns at cv = 0.001
without process error the CDR's standard deviation is the closed form of
England, Verrall and Wuthrich's strong-prior limit. In between it
narrows as the prior tightens (on GenIns with apriori = 0.5, the
total's standard deviation at cv = 0.2 is about 70% of the flat
prior's, at cv = 0.05 about 50%). There is no view over segments:
bayes_bf() fits one segment.
Failed MCMC diagnostics of the fit raise one warning() listing them,
and refits that failed theirs raise another. The result is a
bayes_one_year_fit whose fit is the bayes_bf_fit; its
as.data.frame() adds each origin's exposure, prior_ultimate and
opening_ulr (the opening ultimate over the exposure).
Errors: as bayes_bf(); a k_threshold that is NaN.
This is Python's BayesBf.one_year().
Examples
long <- data.frame(year = rep(2018:2021, 4:1),
age = c(12, 24, 36, 48, 12, 24, 36, 12, 24, 12),
paid = c(100, 150, 165, 170, 110, 170, 180, 120, 175, 130),
premium = rep(c(200, 220, 240, 260), 4:1))
tri <- triangle(long, "year", "age", c("paid", "premium"))
view <- bayes_bf_one_year(tri, "paid", "premium", apriori = 0.85, cv = 0.1,
n_sims = 1000, seed = 1, refit = "reweight_only")
view@fit@prior_ultimate
#> [1] 170 187 204 221
c(one_year = sqrt(variance(view@cdr)), lifetime = sqrt(variance(view@fit@reserves)))
#> one_year lifetime
#> 13.17800 15.05977
as.data.frame(view)
#> origin latest opening_ultimate opening_reserve exposure prior_ultimate
#> 1 2018 170 170.0000 0.00000 200 170
#> 2 2019 180 185.5318 5.53176 220 187
#> 3 2020 175 194.7382 19.73816 240 204
#> 4 2021 130 216.8976 86.89762 260 221
#> opening_ulr cdr_mean cdr_std_dev
#> 1 0.8500000 0.00000000 0.000000
#> 2 0.8433262 0.01313766 2.908150
#> 3 0.8114090 0.03972504 4.469221
#> 4 0.8342216 -0.15243504 10.343588