Skip to contents

The priors of compartmental(), a required argument: the rates and ratios are specific to a line and a book, so the library does not choose them silently. gesmann_morris_priors() is the paper's case study (Gesmann and Morris 2020, model 1): k_er (3, 0.1), k_p (1, 0.1), rlr (0.7, 0.2), rrf (0.8, 0.1), half Student-t(10) effect sds with scales 0.2 and 0.1, LKJ(1), and Student-t(1, 0, 1000) on each log sigma (effectively flat), with no effect on the rates and no development effect. On company 337 the data pull the rates 5 to 9 prior sds from these medians: the posterior is a compromise with the preset, not a description of it. Check any set with compartmental_prior_predictive() before fitting.

Usage

compartmental_priors(
  k_er,
  k_p,
  rlr,
  rrf,
  rlr_effect_sd,
  rrf_effect_sd,
  lkj_eta,
  log_sigma,
  ker_effect_sd = NULL,
  kp_effect_sd = NULL,
  development_effect_sd = NULL
)

gesmann_morris_priors()

gesmann_morris_2_priors()

compartmental_diffuse_priors()

Arguments

k_er, k_p

c(median = , sd = ) of the reporting rate and the payment rate, per year.

rlr, rrf

c(median = , sd = ) of the population reported loss ratio and reserve robustness factor (paid over reported).

rlr_effect_sd, rrf_effect_sd

Priors on the sds of the origin effects on the o scale: list(family = "student_t", nu = , scale = ) for a half Student-t or list(family = "normal", scale = ) for a half normal.

lkj_eta

LKJ shape of the correlation of the two effects (1: uniform).

log_sigma

A list of two priors, on log sigma_os and log sigma_pd in that order, each list(family = "student_t", nu = , location = , scale = ) or list(family = "normal", mean = , sd = ).

ker_effect_sd, kp_effect_sd

Priors on the sds of origin effects on k_er and k_p, in the form of rlr_effect_sd; NULL: no such effect.

development_effect_sd

Priors on the sds of development-year effects: a named list with any of k_er, k_p, rlr and rrf, each in the form of rlr_effect_sd (a parameter left out has no development effect); NULL: no development effect.

Value

A compartmental_priors list.

Details

gesmann_morris_2_priors() is the paper's model 2, from its code (sec. 7.2.3, where it and the text disagree): model 1's rate and ratio priors; origin effects on all four parameters (RLR and RRF correlated, LKJ(1)) and development-year effects on all four, every effect sd half Student-t(10) on the o scale with one scale per parameter, shared by its two groups: 0.3 for k_er and k_p, 0.7 for rlr and 0.5 for rrf; and normal(log 0.2, 0.2) on each log sigma (the text gives a median of 0.1). Use it with compartmental_model_2().

compartmental_diffuse_priors() is the starting point for a fit to paid alone (fitted = "paid_only"): the paper's medians for model 1 with a log-scale sd of 1 on k_er, k_p, rlr and rrf, 5 to 10 times the paper's, and its effect sds and log sigma priors, so the data and not the prior set the rates. It is refused for a fit to incurred alone (fitted = "incurred_only"): no paid cell is fitted there, so the incurred does not identify the payment rate k_p and its prior sets the paid run-off and the reserve at every width (on company 337 -51,000 with an sd of about 150,000 at a log-scale sd of 1, 203,000 at 0.3), and a k_p prior with a log-scale sd above 0.5 is an error. For incurred alone give a k_p prior you believe, for example one from the book's paid history or from a paid-and-incurred fit of a similar book; the paper's narrow prior put the reserve on company 337 26% above the fit to paid and outstanding.

Each positive parameter theta (k_er, k_p, rlr, rrf) is median * exp(sd * o) with o ~ N(0, 1): a log-normal prior with that median and log-scale sd. The effects live on that o scale.

The hierarchy follows from the priors. RLR and RRF always vary by origin, with correlated effects. ker_effect_sd and kp_effect_sd add origin effects on the rates, uncorrelated with the others, and development_effect_sd adds development-year effects on any of the four parameters; NULL (model 1) means no such effect. A development age with no observed cell takes a new effect from the population in each simulation, as an origin with no cell does.

Errors: if a prior has the wrong form or a log-normal median or sd is not finite and positive. The other settings are checked by the fit.

Examples

p <- gesmann_morris_priors()
p$k_er
#> median     sd 
#>    3.0    0.1 
# Wider rate priors, a half-normal effect sd on RRF.
q <- compartmental_priors(k_er = c(median = 2, sd = 0.3), k_p = p$k_p, rlr = p$rlr,
                          rrf = p$rrf, rlr_effect_sd = p$rlr_effect_sd,
                          rrf_effect_sd = list(family = "normal", scale = 0.2),
                          lkj_eta = 2, log_sigma = p$log_sigma)
q$rrf_effect_sd
#> $family
#> [1] "normal"
#> 
#> $scale
#> [1] 0.2
#> 
# Model 2's priors: effects on the rates and by development year too.
p2 <- gesmann_morris_2_priors()
p2$kp_effect_sd
#> $family
#> [1] "student_t"
#> 
#> $nu
#> [1] 10
#> 
#> $scale
#> [1] 0.3
#> 
p2$development_effect_sd$rlr
#> $family
#> [1] "student_t"
#> 
#> $nu
#> [1] 10
#> 
#> $scale
#> [1] 0.7
#>