One-year view of Meyers' CRC, CSR and CAY models
meyers_one_year.RdThe claims development result (CDR) over the coming year of meyers(),
by Pareto smoothed importance sampling of the posterior (decision 19 of
docs/design/reserving-bayes.md). meyers_one_year() fits the
posterior and the lifetime ultimates and reserves as meyers() does
with the same settings. Each simulation picks a posterior draw, draws
the cumulative values of the year's cells from it (the cells valued in
the next twelve months, as in odp_one_year()), reweights every
posterior draw by the likelihood of those values, and smooths the
weights (one Pareto k per simulation). Origin w's CDR is
E[U[w] | D0] - E[U[w] | D0, C], with U the ultimate (the value at
the oldest age) and each expectation the (weighted) posterior mean of
the ultimate's expected value given a draw; an origin the year takes to
the oldest age has its value there instead of the second term. Its
mean is about zero. The draws are reweighted on the unconstrained scale
NUTS samples; the fit's posterior stays on the natural scale.
Usage
meyers_one_year(
triangle,
column,
premium,
model = c("crc", "csr", "cay"),
logelr_mean = -0.4,
logelr_sd = 3.162,
origin_sd = 3.162,
development_sd = 3.162,
gamma_sd = 0.05,
rho_shape = 2,
chains = 4,
tune = 1000,
draws = 2000,
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
)
meyers_one_year_segments(
triangle,
column,
premium,
model = c("crc", "csr", "cay"),
logelr_mean = -0.4,
logelr_sd = 3.162,
origin_sd = 3.162,
development_sd = 3.162,
gamma_sd = 0.05,
rho_shape = 2,
chains = 4,
tune = 1000,
draws = 2000,
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
- triangle
A cumulative triangle with one segment, every origin observed from the first age up to its latest.
- column
Name of the column to fit: paid, or case incurred.
Name of the column with each origin's premium (its latest value, as
cape_cod()reads exposure).- model
"crc", the correlated chain ladder without its correlation between origins,"csr", the changing settlement rate model, or"cay", the correlated accident year model.- logelr_mean, logelr_sd
Mean and standard deviation of the normal prior on
logelr, the log expected loss ratio (3.162 is Meyers' rounding ofsqrt(10)).- origin_sd
Standard deviation of the normal prior on each origin effect
alpha[w],w >= 2.- development_sd
Standard deviation of the normal prior on each development effect
beta[d],d < m.- gamma_sd
Standard deviation of the normal prior on
gamma("csr"only).- rho_shape
Both shapes of the beta prior on
(1 - rho) / 2("cay"only); Meyers' 2 makes the prior density ofrhoproportional to1 - rho^2.- chains, tune, draws
NUTS chains, warm-up draws per chain and kept draws per chain; with 1,000 kept draws the late
sigma[d]sometimes miss the R-hat threshold.- 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; at NUTS's usual 0.8 the paid fits of group 353 leave 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, 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.- 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 segments' total reserves) to the Spearman matrixspearmanand put in a random order, asodp_bootstrap()'s."synchronized"is accepted asodp_bootstrap()takes it, and is an error here.- spearman
With
dependence = "rank_correlation"only: Spearman's rho between the segments' total reserves, asodp_bootstrap()'s.
Details
A simulation whose Pareto k is above k_threshold is handled as
refit says: by default moment-matched, and refitted with NUTS only if
its k stays above the threshold. On Meyers' group 353 nearly every
simulation is flagged and matching rescues about nine in ten, so 10,000
simulations take 4 to 7 minutes on 16 threads, and "refit_flagged"
about 6.7 times as long. The view therefore runs at most 2,000
simulations by default (under a minute and a half there), whatever
n_sims (the lifetime reserves' count) is above that; one_year_sims
sets the count. Fewer simulations cost proportionally less.
meyers_one_year_segments() does the same in every segment of the
triangle, each segment's posterior and simulations as in
meyers_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.
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). The result is a bayes_one_year_fit
whose fit is the meyers_fit (its as.data.frame() adds each
origin's premium and opening_ulr, the opening ultimate over the
premium), or a bayes_one_year_fits with premium.
Errors: as meyers() (or meyers_segments()); a k_threshold that is
NaN; a one_year_sims of 0.
These are Python's Meyers.one_year() and Meyers.one_year_segments().
Examples
long <- data.frame(
year = rep(1988:1993, 6:1),
age = 12 * sequence(6:1),
paid = c(952, 1529, 2813, 3647, 3724, 3832, 849, 1564, 2202, 2432, 2468,
983, 2211, 2830, 3832, 1657, 2685, 3169, 932, 1940, 1162),
premium = rep(c(5812, 4908, 5454, 5165, 5214, 5230), 6:1))
tri <- triangle(long, "year", "age", c("paid", "premium"))
view <- suppressWarnings(meyers_one_year(tri, "paid", "premium", tune = 300, draws = 300,
n_sims = 1000, seed = 1,
refit = "reweight_only"))
view@fit@premium
#> [1] 5812 4908 5454 5165 5214 5230
c(one_year = sqrt(variance(view@cdr)), lifetime = sqrt(variance(view@fit@reserves)))
#> one_year lifetime
#> 13758.75 23913.76
as.data.frame(view)
#> origin latest opening_ultimate opening_reserve premium opening_ulr cdr_mean
#> 1 1988 3832 3832.000 0.0000 5812 0.6593255 0.000000
#> 2 1989 2468 3415.946 947.9461 4908 0.6959955 6.162855
#> 3 1990 3832 4914.999 1082.9993 5454 0.9011733 42.602893
#> 4 1991 3169 6519.408 3350.4081 5165 1.2622281 100.685442
#> 5 1992 1940 5116.562 3176.5621 5214 0.9813123 98.853804
#> 6 1993 1162 7758.433 6596.4326 5230 1.4834479 146.646725
#> cdr_std_dev
#> 1 0.000
#> 2 4200.066
#> 3 2045.780
#> 4 3280.984
#> 5 3185.760
#> 6 7685.851