Prior predictive check of the compartmental model
compartmental_prior_predictive.RdPaths of the mean outstanding and cumulative paid of each origin of the
premium column at each age of the square, drawn from the priors alone
(Gesmann and Morris 2020, sec. 3.4): a check of a prior set before
compartmental() fits it. Each simulation draws the intercepts, the
effect sds, the correlation and each origin's effects. The paths are
means, without the likelihood's noise, which under the preset's
effectively flat prior on log sigma would swamp them. With
development effects in the priors, each simulation also draws each
development level's effects, as the fit has them (shared by the origins:
each age its own under development_levels = "per_age", the ages of a
development year one under "by_year"), and with effects by cell and
paid_response = "incremental" the cumulative paid path is the sum of
the cells' mean increments. Under rate_order = "ordered" the rates are
drawn from their priors restricted to k_er > k_p. The seed is derived from seed, as the fit's
simulations' is.
Arguments
- triangle
A cumulative triangle with one segment.
Name of the column with each origin's premium (its latest value); the fit's origins are this column's.
- priors
A compartmental_priors list; required.
- rate_order
"free"or"ordered", as above.- n_sims
Number of paths; positive.
- seed
Seed of the chains and of the simulations, a non-negative whole number.
- paid_response
"cumulative"or"incremental", as in the fit to be checked; it matters only with effects by cell.- development_levels
"per_age"or"by_year", as in the fit to be checked; it matters only with development effects in the priors.
Value
A list of two predictive_distributions, outstanding and
paid, each with dimensions origin and age (months).
Details
Errors: if a prior setting is invalid, n_sims is 0, or the premium column
is missing or not positive.
Examples
long <- data.frame(year = rep(1988:1990, 3:1), age = c(12, 24, 36, 12, 24, 12),
premium = rep(c(104.4, 88.9, 86.0), 3:1))
tri <- triangle(long, "year", "age", "premium")
paths <- compartmental_prior_predictive(tri, "premium", gesmann_morris_priors(),
n_sims = 1000)
# The mean paid of 1988 at 36 months over its premium, as the preset implies.
quantile(marginal(paths$paid, list(origin = "1988", age = 36)), c(0.05, 0.5, 0.95)) / 104.4
#> [1] 0.3629703 0.5223760 0.7746925