Skip to contents

The second table of compartmental_candidate() in the diagonal backtest: for each of the latest n_diagonals calendar diagonals, the model is fitted to the cells valued before it (the outstanding of the held-out diagonal is always withheld) and forecasts the outstanding of the diagonal's cells, scored by the metrics of diagonal_backtest(). The splits, n_sims, seed and interval are diagonal_backtest()'s, so a backtest with the same arguments and this candidate in its models has fitted the model already and the fits are reused. The one model of the table is named after the candidate with _outstanding. A held-out cell without an outstanding in the triangle, or without a fitted origin or development age, is counted in excluded.

Usage

compartmental_outstanding_backtest(
  candidate,
  n_diagonals,
  n_sims = 1000,
  seed = 0,
  interval = 0.9
)

Arguments

candidate

A compartmental_candidate().

n_diagonals

Number of latest calendar diagonals to hold out, one split each.

n_sims

Number of joint draws of each forecast.

seed

Seed of the sampler chains and of the draws, a non-negative whole number.

interval

Width of the central interval of the coverage metric, in (0, 1).

Value

A backtest object.

Examples

# \donttest{
long <- data.frame(year = rep(1988:1992, 5:1),
                   age = unlist(lapply(5:1, function(k) 12 * seq_len(k))),
                   paid = c(9.6, 22.8, 33.3, 40.3, 45.1, 7.9, 19.5, 29.6, 36.8,
                            8.7, 24.3, 35.4, 13.3, 33.0, 11.4),
                   incurred = c(62.7, 64.0, 65.6, 65.3, 62.3, 62.1, 56.7, 56.6, 56.8,
                                64.0, 61.5, 63.2, 73.9, 75.1, 77.1),
                   premium = rep(c(104.4, 88.9, 86.0, 99.3, 104.9), 5:1))
tri <- triangle(long, "year", "age", c("paid", "incurred", "premium"))
cand <- compartmental_candidate(tri, "paid", "premium", gesmann_morris_priors(),
                                incurred = "incurred", chains = 2, tune = 150,
                                draws = 150, target_accept = 0.9)
compartmental_outstanding_backtest(cand, n_diagonals = 1, n_sims = 200)@mean
#>                           model     crps coverage actual_vs_expected total_crps
#> 1 compartmental_gm1_outstanding 13.26822        1           3.655501   40.56332
#>   mean_log_density total_percentile
#> 1        -4.611852            0.925
# }