Meyers' CRC, CSR and CAY models
meyers_fit.RdMeyers' (2019, CAS Monograph 8) log-normal models of a cumulative
triangle C with premium P, for origins w = 1..n and ages
d = 1..m: log C[w, d] is normal with mean
log P[w] + logelr + alpha[w] + beta[d] g[w] (alpha[1] = 0,
beta[m] = 0) and sd sigma[d], decreasing with age. g[w] is 1 for
the correlated chain ladder without its correlation between origins
("crc") and (1 - gamma)^(w - 1) for the changing settlement rate
("csr"). The correlated accident year model ("cay") keeps
g[w] = 1 and adds rho times the previous origin's residual at the
same age, log C[w - 1, d] less its mean, to the mean of every origin
after the first, so neighbouring origins are correlated; Meyers fits it
to incurred data. The priors are those of Meyers' Stan code: logelr
normal with mean logelr_mean and sd logelr_sd, alpha and beta
normal around 0, gamma normal around 0 with sd gamma_sd,
(1 - rho) / 2 beta with both shapes rho_shape, and each step of
sigma[d]^2 uniform on (1 - exp(-1e-5), 1).
Usage
meyers_fit(ptr)
meyers(
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
)Arguments
- ptr
A
MeyersFitpointer; used internally.- 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.
Details
The ultimate is the value at the oldest age (no tail): each posterior
draw gives each open origin a log-normal ultimate; an origin observed at
the oldest age keeps its value; under "cay" the ultimates are drawn
origin by origin, each from the previous origin's residual at the oldest
age, observed for a closed origin and simulated otherwise.
The reserve is the ultimate less the latest value of the fitted column
(an outstanding reserve on paid data, IBNR on incurred data) and can be
negative. Every observed cell must be positive, and under "cay" every
observed cell after the first origin needs the previous origin's cell at
the same age. One seed replays a fit exactly, whatever the number of
threads: the chains and the simulations each take a seed derived from
it.
Failed MCMC diagnostics (R-hat above 1.01, bulk or tail ESS below 100
per chain, any divergent transition) do not fail the fit: meyers()
raises one warning() listing them, and they stay in the fit's
diagnostics. With the defaults, all 120 fits of a seed sweep on
Meyers' group 353 data (paid and incurred, CRC and CSR, 30 seeds) passed
every threshold, and CAY on incurred passed at 199 of 200 seeds (one
divergent transition in 8,000 draws at the other).
Properties of the fit: model ("crc", "csr" or "cay"), chain_ladder
(the volume-weighted chain_ladder_fit the reserves are measured from),
origins, development, premium (each origin's), ultimates and
reserves (predictive_distributions with dimension origin, one
component per origin, laid out as odp_bootstrap()'s reserves),
diagnostics (a list of max_rhat, min_ess_bulk, min_ess_tail,
divergences and warnings), summary (the posterior summary as
bayes_glm_model's; also summary(fit)) and draws (a matrix of the
posterior draws of logelr, alpha[2], ..., beta[1], ..., gamma
(CSR only) or rho (CAY only), sigma[1], ..., one row per draw, chain
by chain). bayes_loo() gives the PSIS-LOO of the observed cells with
Meyers' pointwise term, the normal density of log C[w, d] (under CAY
conditional on the previous origin's cell, as in Meyers' code), so
compare it only between CRC, CSR and CAY fits of the same column (Meyers
2019, Tables 6.4, 7.3 and 8.3). as.data.frame(), totals_frame(), development_frame() and
segment() work as for bayes_odp(), with the premium, the ulr
(the chain ladder's ultimate over the premium), the mean and
std_dev of the posterior predictive reserve, the ultimate_mean and
ultimate_std_dev of the posterior predictive ultimate and ulr_mean,
the ultimate_mean over the premium.
Errors: if a column is missing, the triangle has several segments or an
origin has a gap; if a premium is missing or not positive; if a prior
standard deviation or rho_shape is not positive and finite,
logelr_mean is not finite or a sampler setting is invalid; if an
observed cell is not positive; if there are no more observed cells than
parameters; or, under "cay", if a cell lacks the previous origin's
cell at the same age.
See also
meyers_segments() for several segments, bayes_odp(), cape_cod(),
bayes_loo().
Examples
long <- data.frame(year = rep(1988:1993, 6:1),
age = unlist(lapply(6:1, function(k) 12 * seq_len(k))),
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"))
# Short chains may miss a diagnostic threshold.
fit <- suppressWarnings(meyers(tri, "paid", "premium", model = "csr", tune = 300,
draws = 300, n_sims = 2000, seed = 1))
head(fit@summary)
#> parameter mean sd q05 q50 q95 rhat
#> 1 logelr -0.426394935 0.3599110 -1.0086181 -0.42163108 0.1736343 1.007469
#> 2 alpha[2] -0.180552832 0.4665789 -0.9273537 -0.18446268 0.5949748 1.009480
#> 3 alpha[3] 0.075458264 0.5763131 -0.8614330 0.08104151 1.0018623 1.007945
#> 4 alpha[4] 0.351432211 0.6805571 -0.7811111 0.33841334 1.5079436 1.002220
#> 5 alpha[5] 0.002117625 0.8602135 -1.4063782 0.00545514 1.4422907 1.001033
#> 6 alpha[6] 0.136031020 1.2503550 -2.0184125 0.13253950 2.1849796 1.006034
#> ess_bulk ess_tail
#> 1 768.3451 535.0850
#> 2 1614.3341 858.1404
#> 3 1285.1687 678.0591
#> 4 1255.6134 769.7839
#> 5 1683.9633 933.3571
#> 6 1428.9811 682.4070
mean(fit@reserves)
#> [1] 18932.33
quantile(fit@ultimates, 0.995)
#> [1] 175549.1