Bayesian hierarchical credibility
hierarchical_credibility.RdBühlmann–Straub's model, or Jewell's hierarchy of it, as a normal
random-effects model sampled with NUTS. Group i in period j has ratio
X_ij ~ N(theta_i, sigma^2 / w_ij); each group's risk premium theta_i
is normal about its node at the level above, each node about its own
parent, and the top about the collective mean mu. The means are
integrated out exactly, so NUTS samples only the standard deviations;
given them, each premium is the credibility formula Z * M + (1 - Z) * E[parent], and the Bayesian premium averages it over their posterior.
Usage
hierarchical_credibility(
ratios,
weights,
levels = NULL,
collective_mean = NULL,
within_prior = NULL,
between_priors = NULL,
chains = 4,
tune = 1000,
draws = 1000,
seed = 0
)
credibility_premiums(
ratios,
weights,
within_variance,
between_variances,
levels = NULL,
collective_mean = NULL
)
credibility_predictive(fit, weights = NULL, n_sims = 10000, seed = 0)Arguments
- ratios
A matrix, one row per group and one column per period;
NAfor a missing cell.- weights
A matrix of the same shape with
NAin the same places.- levels
A list of vectors, one per level above the groups, outermost first: each group's node at that level, from 1.
NULLfor Bühlmann–Straub's model.- collective_mean
c(mean, sd)of a normal prior onmu, orNULLfor a flat one.- within_prior
list("half_normal", scale)orlist("half_cauchy", scale)onsigma;NULLfor half-normal at five times the pooled within standard deviation.- between_priors
A list of such priors, one per level, outermost first and the groups' last;
NULLfor half-normal at five times each level's spread.- chains, tune, draws, seed
NUTS settings.
- within_variance
s^2.- between_variances
One per level, outermost first and the groups' last (
awith one level;bthenawith two).- fit
A
hierarchical_credibilityfit.- n_sims
Number of simulations.
Value
hierarchical_credibility(): a list of class
hierarchical_credibility with premiums, credibility,
level_premiums, collective_mean, group_means, group_weights,
divergences and summary (a data frame of the structure parameters'
posterior: within_variance and between_variance[l]).
credibility_premiums(): a list with premiums, credibility,
level_premiums, level_credibility and collective_mean.
credibility_predictive(): a predictive_distribution with dimension
group.
Details
credibility_premiums() gives that formula at fixed structure
parameters: Bühlmann–Straub's premiums with one level and
Bühlmann–Gisler's hierarchical ones (as actuar::cm(~ cohort + cohort:group)) with more. credibility_predictive() draws each group's
risk premium, or with weights its ratio next period.
Examples
x <- rbind(c(1, 2, 3, 2), c(4, 5, 6, 5), c(2, 3, 4, 3))
w <- matrix(1, 3, 4)
fit <- hierarchical_credibility(x, w, chains = 2, tune = 300, draws = 300)
fit$premiums
#> [1] 2.106355 4.867057 3.026589
credibility_premiums(x, w, within_variance = 0.7, between_variances = 2)$premiums
#> [1] 2.10728 4.86590 3.02682