Skip to contents

The claims development result (CDR) over the coming year of bayes_odp(), by Pareto smoothed importance sampling of the posterior (decision 16 of docs/design/reserving-bayes.md). bayes_odp_one_year() fits the posterior and the lifetime reserves as bayes_odp() does with the same settings. Each simulation picks a posterior draw, draws the year's increments from it with process error (the cells valued in the next twelve months, as in odp_one_year()), reweights every posterior draw by the year's quasi likelihood with the scale and the priors unchanged, and smooths the weights (one Pareto k per simulation). Origin w's CDR is E[R[w] | D0] - (X[w] + E[R'[w] | D0, X]), with R the expected run-off at the opening, X the year's payments and R' the expected run-off after the year, each expectation the (weighted) mean over the posterior draws; its mean is about zero. Every cell up to the end of the year is observed and conditioned on, also for an origin that lags the valuation.

Usage

bayes_one_year_fit(ptr)

bayes_one_year_fits(ptr)

bayes_odp_one_year(
  triangle,
  column = NULL,
  intercept_sd = 10,
  origin_sd = 10,
  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
)

bayes_odp_one_year_segments(
  triangle,
  column = NULL,
  intercept_sd = 10,
  origin_sd = 10,
  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,
  dependence = c("independent", "rank_correlation", "synchronized"),
  spearman = NULL,
  k_threshold = 0.7,
  refit = c("moment_match_then_refit", "refit_flagged", "reweight_only", "refit_all"),
  max_refits = NULL,
  one_year_sims = NULL
)

Arguments

ptr

A BayesOneYearFit or BayesOneYearFits pointer; used internally.

triangle

A cumulative triangle with any number of segments, every origin observed from the first age up to its latest.

column

Name of the column to fit; by default the only one.

intercept_sd

Standard deviation of the normal prior on the intercept c.

origin_sd

Standard deviation of the normal prior on each origin effect a[w], w >= 2.

development_sd

Standard deviation of the normal prior on each development effect b[d], d >= 2.

process

Process error on each simulated future increment: "gamma" (mean mu, variance phi * 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; above NUTS's usual 0.8, which on triangles such as RAA usually leaves a few divergent transitions.

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, as loo::loo_moment_match()), refitting only a simulation whose k stays above k_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 unrefitted and warned about. NULL (the default) refits every one, 0 none. In the _segments functions 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_sims for bayes_odp_one_year() and bayes_bf_one_year(), and n_sims capped at 2,000 for meyers_one_year(). The lifetime reserves keep n_sims. A smaller count gives the first simulations of a larger one.

dependence

How the segments depend on each other: "independent", each segment's own posterior and simulations; or "rank_correlation", the segments' simulations reordered as whole rows (Iman-Conover on the segment totals) to the Spearman matrix spearman and put in a random order, as odp_bootstrap()'s. "synchronized" is accepted as odp_bootstrap() takes it, and is an error here.

spearman

With dependence = "rank_correlation" only: Spearman's rho between the segments' totals, as odp_bootstrap()'s.

Value

A bayes_one_year_fit or bayes_one_year_fits object.

Details

A simulation whose Pareto k is above k_threshold is flagged. With refit = "moment_match_then_refit" (the default) its posterior draws are first moved by affine maps to the moments the weights estimate (moment matching, as loo::loo_moment_match()), and only a simulation whose k stays above k_threshold is refitted with NUTS on the triangle extended by its year, with the model's sampler. 14% to 26% of the simulations are flagged on RAA and GenIns; matching rescues nearly all of them, within 0.04 to 0.06 sd of their refits, at about 1 ms each against about 26 ms for a refit, so a default run of 10,000 simulations takes a few seconds in a release build. "refit_flagged" refits every flagged simulation (one to two minutes there), and "reweight_only" takes about a second. On RAA and GenIns the standard deviation of the total CDR agrees with odp_one_year()'s on average over seeds (with "reweight_only", a ratio of 1.001 on RAA and 1.006 on GenIns over 80 seeds); any single run of 10,000 simulations is within a few percent of it. A triangle with no cells in the coming year (every origin at the last age) has a CDR of zero, Pareto k of 0 and no refits.

bayes_odp_one_year_segments() does the same in every segment of the triangle, each segment's posterior and simulations as in bayes_odp_segments() (segment k's own seeds), into one joint CDR, the segments depending on each other as dependence says: "independent", or "rank_correlation" by Iman-Conover on the segments' total CDR, as the bootstraps' one-year view does.

Failed MCMC diagnostics of the fit raise one warning() listing them, and refits that failed theirs raise another (each prefixed with its segment's label over segments).

Properties of a bayes_one_year_fit: fit (the bayes_odp_fit, the bayes_bf_fit from bayes_bf_one_year(), the bayes_bf_normalised_fit from bayes_bf_normalised_one_year() or the meyers_fit from meyers_one_year(), with the posterior and lifetime reserves), chain_ladder, origins, development; per origin (named as a chain_ladder_fit's) latest, opening_ultimate and opening_reserve (the posterior mean reserve on the observed triangle); cdr, a predictive_distribution of the CDR with dimension origin (a negative value is an adverse development, and -quantile(fit@cdr, 0.005) is the one-year loss at 99.5%); pareto_k (one per simulation, Inf when too few weights differ to fit the tail), refitted (the simulations refitted with NUTS, 1-based), moment_matched (the simulations moment matching rescued, 1-based; empty unless refit = "moment_match_then_refit", when each flagged simulation is in it, in refitted or in unrefitted), unrefitted (the simulations due for a refit beyond max_refits, reweighted instead, 1-based), refit_warnings (how many refits had a diagnostic warning), k_threshold and flagged_share (the share of simulations above it, whether or not they were refitted). A bayes_one_year_fits has the same, without fit, with keys, index, scale (the ODP's only), premium (Meyers' only) and diagnostics (a data.frame as bayes_odp_segments()'s), and with cdr keyed by the triangle's keys and origin; scale, premium, pareto_k, refitted, moment_matched, unrefitted, refit_warnings and flagged_share need a single-segment fit: use segment() or totals_frame(). as.data.frame() has one row per segment and origin: origin, latest, opening_ultimate, opening_reserve, and the cdr_mean and cdr_std_dev of the CDR; totals_frame() one per segment, with the scale and the flagged_share too.

Errors: as bayes_odp() (or bayes_odp_segments()); a k_threshold that is NaN.

These are Python's BayesOdp.one_year() and BayesOdp.one_year_segments(), which return a BayesOneYearFit and a BayesOneYearFits.

See also

bayes_odp(), odp_one_year() for the ODP bootstrap's one-year view, claims_development_result() for Merz and Wuthrich's.

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))
tri <- triangle(long, "year", "age", "paid")
view <- bayes_odp_one_year(tri, n_sims = 1000, seed = 1, refit = "reweight_only")
view@opening_reserve
#>      2018      2019      2020      2021 
#>  0.000000  5.517671 19.452208 86.991644 
view@flagged_share
#> [1] 0.013
# The one-year view is narrower than the lifetime view.
c(one_year = sqrt(variance(view@cdr)), lifetime = sqrt(variance(view@fit@reserves)))
#> one_year lifetime 
#> 14.06473 15.60810 
as.data.frame(view)
#>   origin latest opening_ultimate opening_reserve    cdr_mean cdr_std_dev
#> 1   2018    170         170.0000        0.000000  0.00000000    0.000000
#> 2   2019    180         185.5177        5.517671  0.14325340    2.784430
#> 3   2020    175         194.4522       19.452208  0.03401722    4.360616
#> 4   2021    130         216.9916       86.991644 -0.40227267   11.554268