An ILS deal analysis with prospicio
ils_deal_analysis.RmdRendered from examples/ils_deal_analysis.qmd.
The code runs each time the site is built, so the output below is
current.
An investment fund gets an offer of a share of a cedant’s 2026 premium as a collateralised reinsurance deal. The insurance-linked securities (ILS) market writes this kind of deal. The fund puts collateral in a trust, and the cedant pays premium into the trust. The trust pays the losses, and the fund gets the remainder when the deal commutes.
The fund asks about the return to its investors. What return does the
deal give, how likely is a loss, and how do the alternative structures
compare? This document is the R twin of ils_deal_analysis.ipynb,
with the same data, seeds and model, and its numbers agree with the
notebook’s numbers. It answers the questions in six steps:
- read a submission and build the cedant’s loss triangle,
- show the historical exhibits and test how well a Bayesian model forecasts the cedant’s history,
- estimate an industry prior from peer triangles, and fit the cedant’s ultimates against it,
- draw the 2026 loss ratio from the fit, and apply the reinsurance structure, the collateral and the cash flows to it,
- read the investor’s IRR, MOIC and downside from the simulations, and compare two structures,
- after binding, compare the next diagonal of actual losses with the one-year forecast.
The prose is shorter than the prose of the notebook, which explains each step. Read the two together.
The data. The submission is the synthetic one of
submission_evaluation.ipynb.
examples/data/make_submission.py wrote it from known
parameters. Here the cedant offers a 20% quota share of
its commercial property book for 2026. Thus the loss to the fund is a
share of the loss ratio of the cedant’s whole book. All the deal terms
below (the share, the commission, the collateral rule, the yield) are
assumptions for the demonstration, not values in the files.
To run the document:
- Clone the repository.
- Install the R package (
remotes::install_github, seeR/prospicio/bootstrap.R). - From any folder in the repository, render with
quarto render examples/ils_deal_analysis.qmd.
Set the environment variable PROSPICIO_EXAMPLE_SIMS to
run fewer simulations.
library(prospicio)
N_SIMS <- as.integer(Sys.getenv("PROSPICIO_EXAMPLE_SIMS", "10000"))
N_ONE_YEAR <- min(N_SIMS, 1000L) # one-year simulations for the monitoring section
SAMPLER <- list(chains = 4, tune = 600, draws = 600) # small on purpose: the demo runs in a few minutes
SEED <- 20261023
# The submission's folder, from wherever the document renders inside the repository.
find_data <- function(start = getwd()) {
dir <- normalizePath(start, winslash = "/")
repeat {
for (sub in c("examples/data/submission", "data/submission")) {
candidate <- file.path(dir, sub)
if (dir.exists(candidate)) return(candidate)
}
parent <- dirname(dir)
if (identical(parent, dir)) stop("examples/data/submission not found above ", start)
dir <- parent
}
}
DATA <- find_data()
read_csv <- function(name) read.csv(file.path(DATA, name), stringsAsFactors = FALSE)
when <- function(text) {
p <- as.integer(strsplit(text, "-")[[1]])
year_fraction(p[1], p[2], p[3])
}
money <- function(x) sprintf("%.1fm", x / 1e6)
# The i-th point of a low-discrepancy sequence on (0, 1): the same numbers as the notebook, with no generator to differ.
uniform <- function(i) (0.5 + i * 0.6180339887498949) %% 1
normal <- function(i) qnorm(uniform(i))
sd_pop <- function(x) sqrt(mean((x - mean(x))^2))
cat("submission files in", basename(dirname(DATA)), "/", basename(DATA), ";", N_SIMS, "simulations, seed", SEED, "\n")## submission files in data / submission ; 10000 simulations, seed 20261023
1. The submission and the cedant’s triangle
The files give the loss triangle (paid and incurred by accident year and age), the premium by year and the rate changes. The rate changes restate the premium of each year at the current rate level (the on-level premium). The 2026 loss ratio forecast is on the 2026 on-level premium.
program_table <- read_csv("treaty_program.csv")
program <- setNames(program_table$value, program_table$item)
subject <- read_csv("subject_premium.csv")
YEARS <- subject$calendar_year
SUBJECT_PREMIUM <- setNames(subject$subject_premium, YEARS)
P_2026 <- as.numeric(program[["estimated_subject_premium_income"]])
rate_rows <- read_csv("rate_changes.csv")
effective <- vapply(rate_rows$effective_date, when, numeric(1))
onlevel <- setNames(vapply(YEARS, function(y) {
SUBJECT_PREMIUM[[as.character(y)]] *
rate_level(effective, rate_rows$average_rate_change, start = y, end = y + 1, term = 1)$on_level_factor
}, numeric(1)), YEARS)
tri_rows <- read_csv("triangle.csv")
tri_rows$onlevel <- onlevel[as.character(tri_rows$accident_year)]
triangle_all <- triangle(tri_rows, "accident_year", "development_months", c("paid", "incurred", "onlevel"))
cat(sprintf("cedant %s; %s; treaty year %s to %s\n", program[["cedant"]], program[["line_of_business"]],
program[["period_start"]], program[["period_end"]]))## cedant Northgate Mutual (synthetic); commercial property, per risk excess of loss; treaty year 2026-01-01 to 2026-12-31
cat(sprintf("estimated 2026 subject premium %s; triangle origins %s to %s, %d ages\n", money(P_2026),
triangle_all@origins[1], tail(triangle_all@origins, 1), length(triangle_all@development)))## estimated 2026 subject premium 179.9m; triangle origins 2016 to 2025, 10 ages
2. Historical exhibits and a backtest
The paid chain ladder gives the cedant’s payment pattern, a check on the pattern the model fits in section 4. The loss ratio by accident year at its latest age, on on-level premium, shows the level and the spread to compare with the prior.
chain <- chain_ladder(triangle_all, "paid")
CDF <- as.numeric(chain@cdf)
AGES <- 12 * seq_along(CDF)
last_rows <- tri_rows[!duplicated(tri_rows$accident_year, fromLast = TRUE), ]
latest_incurred <- setNames(last_rows$incurred, last_rows$accident_year)
loss_ratio_now <- latest_incurred[as.character(YEARS)] / onlevel[as.character(YEARS)]
cat("paid chain ladder: age (months), factor to ultimate, share paid\n")## paid chain ladder: age (months), factor to ultimate, share paid
print(data.frame(age = AGES, cdf = round(CDF, 3), paid = sprintf("%.1f%%", 100 / CDF)), row.names = FALSE)## age cdf paid
## 12 2.560 39.1%
## 24 1.381 72.4%
## 36 1.130 88.5%
## 48 1.044 95.7%
## 60 1.016 98.4%
## 72 1.007 99.3%
## 84 1.002 99.8%
## 96 1.001 99.9%
## 108 1.000 100.0%
## 120 1.000 100.0%
print(data.frame(year = YEARS, on_level_premium = money(onlevel), incurred_now = money(latest_incurred),
incurred_lr = sprintf("%.1f%%", 100 * loss_ratio_now)), row.names = FALSE)## year on_level_premium incurred_now incurred_lr
## 2016 133.9m 41.5m 31.0%
## 2017 138.0m 52.0m 37.7%
## 2018 142.1m 57.9m 40.8%
## 2019 146.4m 62.2m 42.5%
## 2020 150.8m 70.8m 46.9%
## 2021 155.3m 79.8m 51.4%
## 2022 160.0m 80.5m 50.3%
## 2023 164.7m 67.7m 41.1%
## 2024 169.7m 83.7m 49.3%
## 2025 174.8m 56.2m 32.2%
op <- par(mfrow = c(1, 2), mar = c(5, 4, 3, 1))
plot(c(0, AGES / 12), c(0, 1 / CDF), type = "b", xlab = "years since the start of the accident year",
ylab = "share of ultimate paid", main = "Paid pattern (chain ladder)")
barplot(loss_ratio_now, names.arg = YEARS, las = 2, ylab = "incurred loss ratio at latest age",
main = "Loss ratio by accident year")
par(op)A diagonal backtest holds out the latest calendar diagonals. For each diagonal, it fits the model on the data known before that diagonal and scores the forecast of the cells that came next. Here the model is the Bayesian over-dispersed Poisson chain ladder on two diagonals, with a small sampler to keep the document fast.
backtest <- diagonal_backtest(triangle_all, "paid", list(bayes_odp = do.call(bayes_odp_spec, SAMPLER)), 2,
n_sims = 500, seed = SEED)
cat("held-out diagonals:", paste(backtest@diagonals, collapse = ", "), "\n")## held-out diagonals: 2024, 2025
print(backtest@mean, row.names = FALSE)## model crps coverage actual_vs_expected total_crps mean_log_density
## bayes_odp 220492 0.875 0.9942995 545254.1 -13.89999
## total_percentile
## 0.471
3. The industry prior
industry_prior() estimates an outside view of the line
from other companies’ triangles of the same line (#604): the mean
ultimate loss ratio (apriori), how far a company’s level
strays from it (between_cv), how far an origin strays from
its company (cv), and a prior on the development pattern.
reserving-industry-prior.qmd
builds one from a Schedule P line, and tests it on held-out
companies.
The peer triangles below are synthetic, so that the
document runs without the fetch. A fixed low-discrepancy sequence draws
them, so that this document has the numbers of the notebook. There are
twelve companies with nine accident years at nine ages (the ages of the
fit in section 4, since the pattern prior’s ages must be the
triangle’s). Each has its own level, its own pattern and noise in each
cell. With real data, replace peers with the companies’
triangles and premiums. The method is the same.
N_PEERS <- 12
PEER_AGES <- 12 * 1:9
PEER_SHARES <- c(0.38, 0.33, 0.16, 0.07, 0.03, 0.015, 0.008, 0.004, 0.003) # the line's incremental pattern
# One company: a level, a pattern, an origin effect and noise in each cell, from the fixed sequence.
peer <- function(i) {
level <- 0.48 + 0.06 * normal(i)
shares <- PEER_SHARES * exp(0.10 * normal(50 + 9 * i + 0:8))
shares <- shares / sum(shares)
premium <- 1e8 * (0.5 + 1.5 * uniform(500 + 9 * i + 0:8))
rows <- do.call(rbind, lapply(0:8, function(w) {
ratio <- level * (1 + 0.12 * normal(1000 + 9 * i + w))
d <- 0:(8 - w)
cells <- premium[w + 1] * ratio * shares[d + 1] * exp(0.05 * normal(2000 + 81 * i + 9 * w + d))
data.frame(origin = 2016 + w, age = PEER_AGES[d + 1], paid = cumsum(cells))
}))
list(triangle = triangle(rows, "origin", "age", "paid"), premium = premium)
}
peers <- lapply(0:(N_PEERS - 1), peer)
prior <- industry_prior(lapply(peers, `[[`, "triangle"), "paid", premiums = lapply(peers, `[[`, "premium"))
M_PRIOR <- prior@apriori
CV_PRIOR <- prior@cv
COMMON_CV <- prior@common_cv
cat(sprintf("%d companies, %d origins; warnings: %s\n", prior@report$n_companies_used, prior@report$n_origins_used,
if (length(prior@report$warnings)) paste(prior@report$warnings, collapse = "; ") else "none"))## 12 companies, 96 origins; warnings: none
cat(sprintf("inputs used below: apriori %.3f (se %.3f), cv %.3f, common cv %.3f\n",
M_PRIOR, prior@apriori_se, CV_PRIOR, COMMON_CV))## inputs used below: apriori 0.479 (se 0.016), cv 0.127, common cv 0.107
cat("prior percent developed:", paste(sprintf("%.0f%%", 100 * prior@percent_developed), collapse = ", "), "\n")## prior percent developed: 38%, 71%, 87%, 94%, 97%, 98%, 99%, 100%, 100%
4. The cedant’s ultimates against that prior
bayes_bf_normalised() is the Bayesian
Bornhuetter-Ferguson with the prior on the expected
ultimate of each accident year. apriori is the
expected ultimate loss ratio, cv sets how firmly the model
holds each year to the cedant’s level, and common_cv sets
how far that level may stray from apriori, one error shared
by all the years. The pattern prior takes the place of a vague prior on
the shares. bayes_bf_industry() fits it under the prior of
section 3. The model fits the paid triangle on on-level
premium, so that its pattern is the payment pattern that the cash flows
need.
The model has no tail beyond the last age. The chunk drops the oldest age for three reasons:
- only 2016 has it,
- the chain ladder shows no development there,
- the model needs the increments of every column to sum to more than zero.
fit_rows <- tri_rows[tri_rows$development_months <= 108, ]
build <- function(rows) triangle(rows, "accident_year", "development_months", c("paid", "onlevel"))
newest <- !duplicated(fit_rows$accident_year, fromLast = TRUE)
latest_fit <- setNames(fit_rows$paid[newest], fit_rows$accident_year[newest])
fit <- do.call(bayes_bf_industry,
c(list(build(fit_rows), "paid", "onlevel", prior, n_sims = N_SIMS, seed = SEED), SAMPLER))
origins <- as.integer(fit@origins)
exposure <- setNames(fit@exposure, origins)
# Per origin: each simulation's ultimate (latest paid plus its reserve) over the on-level premium (#602).
ultimate_lr <- lapply(setNames(origins, origins), function(o) {
loss_ratio_draws(fit, as.character(o), exposure[[as.character(o)]])
})
post_mean <- vapply(ultimate_lr, mean, numeric(1))
post_cv <- vapply(ultimate_lr, sd_pop, numeric(1)) / post_mean
cat("ultimate loss ratio, paid basis: posterior mean, cv, and the prior mean\n")## ultimate loss ratio, paid basis: posterior mean, cv, and the prior mean
print(data.frame(year = origins, posterior = sprintf("%.3f", post_mean), cv = sprintf("%.3f", post_cv),
prior = sprintf("%.3f", M_PRIOR)), row.names = FALSE)## year posterior cv prior
## 2016 0.310 0.000 0.479
## 2017 0.377 0.000 0.479
## 2018 0.409 0.002 0.479
## 2019 0.427 0.002 0.479
## 2020 0.474 0.003 0.479
## 2021 0.522 0.004 0.479
## 2022 0.517 0.006 0.479
## 2023 0.436 0.010 0.479
## 2024 0.554 0.014 0.479
## 2025 0.477 0.030 0.479
cat("pattern (share paid at each age):", paste(sprintf("%.3f", fit@pattern), collapse = ", "), "\n")## pattern (share paid at each age): 0.385, 0.331, 0.159, 0.072, 0.027, 0.012, 0.007, 0.004, 0.003
## sampler diagnostics: max R-hat 1.003514
5. The 2026 loss ratio
The model forecasts the cells of the years in the triangle. Section 4
reads a loss ratio for each simulation with
loss_ratio_draws(): latest paid plus the reserve of that
simulation, divided by premium (#602). For 2026, a year that is not in
the triangle, bayes_new_year() draws the posterior
predictive (#598). Each simulation takes a posterior draw of the
cedant’s level (the common multiplier), draws the year’s expected
ultimate about it with the prior’s cv, and adds process
error. The draws are paired row by row with the pattern of the same
posterior draw, which section 7 uses.
Without common_cv the new year would be the prior
itself, whatever the triangle says. With it, the level is the cedant’s
own, pooled over all the years. The model has no trend.
The chunk prints the mean of the last five years beside the forecast:
loss ratios have increased over the ten years, so a level pooled over
all of them can understate 2026. The returns in section 8 rest on this
forecast, so they flatter the deal by that gap, and a reviewer should
challenge it.
year_2026 <- bayes_new_year(fit, P_2026, n_sims = N_SIMS, seed = SEED)
LR <- as.vector(draw_matrix(year_2026@loss_ratio)) # the 2026 ultimate loss ratio, one per simulation
RECENT <- as.character(tail(origins, 5))
MU_RECENT <- mean(post_mean[RECENT])
cat(sprintf("%s loss ratio: mean %.3f, cv %.3f; the last five years' posterior mean %.3f, the prior %.3f\n",
year_2026@origin, mean(LR), sd_pop(LR) / mean(LR), MU_RECENT, M_PRIOR))## 2026 loss ratio: mean 0.454, cv 0.134; the last five years' posterior mean 0.501, the prior 0.479
cat("percentiles 5, 50, 95:", paste(sprintf("%.3f", sort(LR)[floor(N_SIMS * c(0.05, 0.5, 0.95)) + 1]), collapse = ", "), "\n")## percentiles 5, 50, 95: 0.358, 0.451, 0.557
6. The structure
The fund takes 20% of the cedant’s subject premium and of its losses: a quota share. The document compares two commission terms:
- A, flat: a 32% ceding commission in all outcomes.
- B, sliding scale: the commission decreases as the loss ratio increases. It goes from 36% at a loss ratio of 45% to 24% at 70%, through 32% at 52%.
apply_tower() applies the contract to the 2026 annual
losses (the loss ratio times the premium), one for each simulation.
deal_ratios() gives the loss ratio, the commission, the
brokerage and the margin of each simulation.
CESSION <- 0.20
BROKERAGE <- 0.025
CEDED_PREMIUM <- CESSION * P_2026
annual_loss <- LR * P_2026 # the cedant's whole-book loss, one per simulation
flat <- quota_share("A_flat", CESSION)
flat <- with_brokerage(with_ceding_commission(with_premium_rate(flat, 1, P_2026), 0.32), BROKERAGE)
sliding <- quota_share("B_sliding", CESSION)
sliding <- with_brokerage(with_sliding_scale(with_premium_rate(sliding, 1, P_2026),
c(0.36, 0.32, 0.24), c(0.45, 0.52, 0.70)), BROKERAGE)
deals <- list()
for (name in c("A_flat", "B_sliding")) {
tower <- reinsurance_tower(list(if (name == "A_flat") flat else sliding))
result <- apply_tower(tower, annual_loss)
ratios <- deal_ratios(tower, result, name)
column <- function(n) marginal(ratios, n)@draws
deals[[name]] <- list(tower = tower, result = result, loss = column("loss_ratio"),
commission = column("ceding_commission") + column("brokerage"), margin = column("margin"))
}
print(data.frame(structure = names(deals),
mean_LR = sprintf("%.3f", vapply(deals, function(d) mean(d$loss), 0)),
mean_comm_brkg = sprintf("%.3f", vapply(deals, function(d) mean(d$commission), 0)),
mean_margin = sprintf("%+.3f", vapply(deals, function(d) mean(d$margin), 0)),
sd_margin = sprintf("%.3f", vapply(deals, function(d) sd_pop(d$margin), 0))), row.names = FALSE)## structure mean_LR mean_comm_brkg mean_margin sd_margin
## A_flat 0.454 0.345 +0.201 0.061
## B_sliding 0.454 0.371 +0.176 0.044
cat("ceded premium", money(CEDED_PREMIUM), "\n")## ceded premium 36.0m
7. Collateral and cash flows
The money moves monthly. The parts:
-
Payment pattern. Each simulation pays on its own
pattern (#600, #673).
monthly_pattern_draws(year_2026, 120, basis = underwriting_basis())reads the pattern of each simulation’s posterior draw, paired row by row withLR, month by month for a year of policies written evenly through 2026, each earning over twelve months (#722). The rows run for as many months as the converted patterns need to reach 1, though the deal commutes at month 60.cashflow_run(paid_patterns =)pays each simulation on its row. The terms’ own paid pattern, the mean of the rows, is whatdeal_ave()compares with in section 10. - Premium. The cedant writes premium evenly over 2026 and collects it as written. Each policy earns over twelve months, so a year of policies written evenly earns over 24 months and is fully earned after that. The written and earned shares are on the same basis as the paid rows.
- Collateral. The trust must hold 30% of the unearned premium plus 125% of the outstanding loss (the ultimate loss of the deal less paid to date).
- Yield, expenses and commutation. The trust earns 3% a year, and expenses are 0.5% a year of the requirement. At month 60 the deal commutes.
The cash-flow engine takes the ultimate loss ratio of the
deal in each simulation and returns the investor’s
flows. The premium into the trust is collected_rate times
the premium, a fixed value in the terms. The sliding scale makes the
commission different in each simulation. Thus the chunk groups the
simulations by commission rate, to 0.1 percentage point. It runs the
engine once for each group with the collected_rate of that
group, and puts the flows back in simulation order.
T_MONTHS <- 60
pattern <- payment_pattern_from_development(AGES / 12, c(pmax(1, CDF[-length(CDF)]), 1))
MONTHS <- 120 # the rows run until the last converted pattern reaches 1
# Premium written evenly over 2026, each policy earning over twelve months; each simulation paid on its own row.
basis <- underwriting_basis()
paid_draws <- monthly_pattern_draws(year_2026, MONTHS, basis = basis)
written <- pmin(1, seq_len(MONTHS) / 12)
earned <- pmin(1, cumsum(c(basis$exposure, rep(0, MONTHS - length(basis$exposure)))))
paid <- colMeans(paid_draws)
duration <- sum(pattern$times * pattern$shares)
cat(sprintf("chain ladder pattern: mean time to payment %.2f years; mean of the drawn patterns, paid by month 12, 24, 60: %.1f%%, %.1f%%, %.1f%%\n",
duration, 100 * paid[12], 100 * paid[24], 100 * paid[60]))## chain ladder pattern: mean time to payment 2.07 years; mean of the drawn patterns, paid by month 12, 24, 60: 14.8%, 57.8%, 96.4%
requirement <- cashflow_requirement(c("unearned-premium" = 0.30, outstanding = 1.25))
make_terms <- function(commission) {
cashflow_terms(CEDED_PREMIUM, T_MONTHS, written, earned, paid, requirement,
commutation_requirement = cashflow_requirement(c(outstanding = 1.0)),
collected_rate = 1 - commission, annual_yield = 0.03, expense_rate = 0.005)
}
run_structure <- function(u, commission) {
# One engine run for each distinct commission rate, flows back in simulation order.
groups <- split(seq_along(u), round(commission, 3))
flows <- matrix(0, length(u), T_MONTHS)
funded <- numeric(length(u))
opening <- numeric(length(u))
for (g in names(groups)) {
index <- groups[[g]]
out <- cashflow_run(make_terms(as.numeric(g)), u[index], paid_patterns = paid_draws[index, , drop = FALSE])
flows[index, ] <- out$flows
funded[index] <- out$funded
opening[index] <- out$opening
}
list(flows = flows, funded = funded, opening = opening)
}
for (name in names(deals)) {
d <- deals[[name]]
run <- run_structure(d$loss, d$commission)
d$flows <- run$flows
d$funded <- run$funded
d$opening <- run$opening
d$run <- deal_run_from_tower(name, d$tower, d$result, name, flows = run$flows, funded = run$funded,
opening = run$opening, patterns = list(written, earned, paid))
# A book of one deal: its IRR and MOIC in each simulation. The IRR search starts at -95% to +100% a year.
# The best years of this deal are above 100%, so with extend = TRUE a simulation with no root there is searched
# above and below that range, and the root nearer 0 is taken (#675).
book_cf <- book_cashflows(deal_book(list(d$run)), extend = TRUE)
d$rate <- book_cf$irr$rate
d$moic <- book_cf$moic
deals[[name]] <- d
}
cat(length(deals), "structures run,", N_SIMS, "simulations each,", T_MONTHS, "months\n")## 2 structures run, 10000 simulations each, 60 months
cat("capital called from the fund over the term, summed (mean; it is recycled as losses are paid):",
paste(names(deals), money(vapply(deals, function(d) mean(d$funded), 0)), collapse = ", "), "\n")## capital called from the fund over the term, summed (mean; it is recycled as losses are paid): A_flat 19.3m, B_sliding 19.4m
8. What the investor gets
For each structure, the chunk computes the return of each simulation:
- the IRR. The search starts between -95% and 100% a
year. The best years of this deal are above 100%, so the chunk sets
extend = TRUE(#675): when the search finds no root in that range, it looks above and below it, so no simulation drops out of the percentiles (#670). The chunk still excludes and counts any simulation with no root at all. - the MOIC: one plus the net flows divided by the capital called from the fund.
- the downside: the probability of a negative IRR or a MOIC below 1, and the mean of the worst 5% of IRRs.
rows <- lapply(names(deals), function(name) {
d <- deals[[name]]
rate <- d$rate[is.finite(d$rate)]
ordered <- sort(rate)
pct <- function(p) ordered[min(length(ordered), floor(p * length(ordered)) + 1)]
worst <- ordered[seq_len(max(1, length(ordered) %/% 20))]
data.frame(structure = name, mean_MOIC = sprintf("%.3f", mean(d$moic)), IRR_p5 = sprintf("%+.1f%%", 100 * pct(0.05)),
IRR_p50 = sprintf("%+.1f%%", 100 * pct(0.5)), IRR_p95 = sprintf("%+.1f%%", 100 * pct(0.95)),
P_IRR_neg = sprintf("%.1f%%", 100 * mean(rate < 0)), P_MOIC_lt_1 = sprintf("%.1f%%", 100 * mean(d$moic < 1)),
IRR_TVaR5 = sprintf("%+.1f%%", 100 * mean(worst)), no_root = length(d$rate) - length(rate))
})
print(do.call(rbind, rows), row.names = FALSE)## structure mean_MOIC IRR_p5 IRR_p50 IRR_p95 P_IRR_neg P_MOIC_lt_1 IRR_TVaR5
## A_flat 1.462 +22.8% +55.6% +113.6% 0.0% 0.0% +16.9%
## B_sliding 1.407 +26.1% +43.6% +92.3% 0.0% 0.0% +22.1%
## no_root
## 0
## 0
op <- par(mfrow = c(1, 2), mar = c(5, 4, 3, 1))
colours <- c(rgb(0.2, 0.4, 0.8, 0.5), rgb(0.9, 0.5, 0.1, 0.5))
hist(deals$A_flat$rate[is.finite(deals$A_flat$rate)], breaks = seq(-0.95, 5, by = 0.025), col = colours[1],
xlim = c(-0.5, 1.0), main = "Investor IRR", xlab = "IRR (annual)")
hist(deals$B_sliding$rate[is.finite(deals$B_sliding$rate)], breaks = seq(-0.95, 5, by = 0.025), col = colours[2],
add = TRUE)
hist(deals$A_flat$moic, breaks = 60, col = colours[1], xlim = c(0.5, 1.6), main = "Investor MOIC", xlab = "MOIC")
hist(deals$B_sliding$moic, breaks = 60, col = colours[2], add = TRUE)
legend("topright", legend = names(deals), fill = colours, bty = "n")
par(op)risk_ratios() takes the margin of each simulation, where
large is good. It returns Sharpe, Sortino, Omega and the TVaR ratio
about a threshold (here a target margin of 10%). The quantity is the
deal’s margin (one less the combined ratio), not the
fund’s return.
for (name in names(deals)) {
cat(name, "\n")
print(round(unlist(risk_ratios(deals[[name]]$margin, threshold = 0.10, tvar_levels = 95)), 3))
}## A_flat
## Sharpe Sortino Omega TVaR ratio 95
## 1.663 10.793 62.652 -1.509
## B_sliding
## Sharpe Sortino Omega TVaR ratio 95
## 1.723 24.935 228.763 -0.777
9. Comparing the structures
book_summary() shows the premium, loss and deductions of
the structures side by side. A deal_book() adds its deals
on the same simulated years, so its total row would be
a portfolio that holds both structures. Read only the rows of each
structure.
summary_book <- book_summary(deal_book(lapply(deals, function(d) d$run)))
summary_book <- summary_book[summary_book$deal != "total", ]
print(data.frame(deal = summary_book$deal, item = summary_book$item, mean = money(summary_book$mean),
ratio_to_premium = sprintf("%.3f", summary_book$ratio)), row.names = FALSE)## deal item mean ratio_to_premium
## A_flat premium 36.0m 1.000
## A_flat loss 16.3m 0.454
## A_flat ceding_commission 11.5m 0.320
## A_flat brokerage 0.9m 0.025
## A_flat total_deductions 12.4m 0.345
## A_flat nmbf 7.2m 0.201
## A_flat margin 7.2m 0.201
## B_sliding premium 36.0m 1.000
## B_sliding loss 16.3m 0.454
## B_sliding ceding_commission 12.4m 0.346
## B_sliding brokerage 0.9m 0.025
## B_sliding total_deductions 13.3m 0.371
## B_sliding nmbf 6.3m 0.176
## B_sliding margin 6.3m 0.176
10. Monitoring after binding
Each quarter brings a new diagonal of actual paid losses. The check holds out the latest diagonal and fits the model on the data known one year earlier. It takes the one-year view (the distribution of the claims development result over the next year) and compares it with the actual diagonal.
The realised result is the opening reserve, less the amount paid in the year, less the closing reserve, for each accident year in the triangle. The model fitted to the full triangle estimates the closing reserve.
This check is on the cedant’s history. The second chunk
checks the deal itself (#603). deal_ave()
compares the deal’s actual cumulative paid at the end of each month with
the paid that the priced simulations expected. The submission has no
data after binding, so the actual paid below is an
illustration: losses emerge on the pattern at a loss
ratio 25% above the priced mean, for the first 24 months. With real
data, replace actual with the cedant’s reported paid, as a
share of the deal. cashflow_valuation() then projects the
remaining flows from the state of the trust at that month.
valuation_year <- function(rows) rows$accident_year + rows$development_months %/% 12 - 1
last <- max(valuation_year(fit_rows))
opening_rows <- fit_rows[valuation_year(fit_rows) < last, ]
newest_open <- !duplicated(opening_rows$accident_year, fromLast = TRUE)
paid_open <- setNames(opening_rows$paid[newest_open], opening_rows$accident_year[newest_open])
view <- do.call(bayes_bf_industry_one_year,
c(list(build(opening_rows), "paid", "onlevel", prior, n_sims = N_ONE_YEAR,
seed = SEED, one_year_sims = N_ONE_YEAR), SAMPLER))
cdr <- total(view@cdr)@draws
opening_reserve <- view@opening_reserve
closing_reserve <- vapply(names(opening_reserve), function(o) mean(marginal(fit@reserves, o)@draws), 0)
paid_in_year <- latest_fit[names(opening_reserve)] - paid_open[names(opening_reserve)]
realised <- sum(opening_reserve - paid_in_year - closing_reserve)
percentile <- mean(cdr <= realised)
cat(sprintf("valuation %d: one-year claims development result, forecast mean %s, sd %s; realised %s, at the %.0f%% percentile of the forecast\n",
last, money(mean(cdr)), money(sd_pop(cdr)), money(realised), 100 * percentile))## valuation 2025: one-year claims development result, forecast mean 0.1m, sd 2.7m; realised 1.9m, at the 74% percentile of the forecast
deal_a <- deals[["A_flat"]]
ACTUAL_LR <- 1.25 * mean(deal_a$loss) # an illustration: the deal runs 25% above the priced mean
actual <- ACTUAL_LR * CEDED_PREMIUM * paid[1:24] # the deal's cumulative paid, months 1 to 24
ave <- deal_ave(actual, make_terms(0.32 + BROKERAGE), deal_a$loss)
thousands <- function(x) paste0(formatC(x / 1e3, format = "f", digits = 0, big.mark = ","), "k")
at <- c(6, 12, 18, 24)
print(data.frame(month = at, actual_paid = thousands(ave$actual[at]), expected = thousands(ave$expected[at]),
ratio = sprintf("%.2f", ave$ratio[at]), percentile = sprintf("%.0f%%", 100 * ave$percentile[at]),
p5 = thousands(ave$q5[at]), p95 = thousands(ave$q95[at])), row.names = FALSE)## month actual_paid expected ratio percentile p5 p95
## 6 497k 398k 1.25 96% 314k 489k
## 12 3,025k 2,420k 1.25 96% 1,910k 2,973k
## 18 7,603k 6,082k 1.25 96% 4,799k 7,471k
## 24 11,783k 9,426k 1.25 96% 7,437k 11,579k
11. A summary for the investor
One table of the results, as a plain printout of the quantities
above. docs/guides/submission-schema.md writes the tables
of a report for an investment committee, and the templates in
examples/templates/ render them (#605).
report <- data.frame(item = c("2026 loss ratio, mean (cv)", "industry prior apriori (cv, common cv)", "ceded premium",
"chain ladder pattern, mean time to payment", "backtest sampler warnings",
"monitoring: realised CDR percentile", "monitoring: deal paid at month 24, percentile"),
value = c(sprintf("%.1f%% (%.0f%%)", 100 * mean(LR), 100 * sd_pop(LR) / mean(LR)),
sprintf("%.1f%% (%.0f%%, %.0f%%)", 100 * M_PRIOR, 100 * CV_PRIOR, 100 * COMMON_CV), money(CEDED_PREMIUM),
sprintf("%.2f years", duration), as.character(nrow(backtest@warnings)),
sprintf("%.0f%%", 100 * percentile), sprintf("%.0f%%", 100 * ave$percentile[24])))
for (name in names(deals)) {
d <- deals[[name]]
rate <- d$rate[is.finite(d$rate)]
report <- rbind(report,
data.frame(item = paste0(name, ": median IRR / mean MOIC"),
value = sprintf("%+.1f%% / %.3f", 100 * sort(rate)[length(rate) %/% 2 + 1], mean(d$moic))),
data.frame(item = paste0(name, ": P(IRR < 0)"), value = sprintf("%.1f%%", 100 * mean(rate < 0))))
}
print(report, row.names = FALSE)## item value
## 2026 loss ratio, mean (cv) 45.4% (13%)
## industry prior apriori (cv, common cv) 47.9% (13%, 11%)
## ceded premium 36.0m
## chain ladder pattern, mean time to payment 2.07 years
## backtest sampler warnings 0
## monitoring: realised CDR percentile 74%
## monitoring: deal paid at month 24, percentile 96%
## A_flat: median IRR / mean MOIC +55.6% / 1.462
## A_flat: P(IRR < 0) 0.0%
## B_sliding: median IRR / mean MOIC +43.6% / 1.407
## B_sliding: P(IRR < 0) 0.0%
Issues for the workarounds
The table lists each step that works around a gap in
prospicio, with the issue for the gap. Where the issue is
closed, the document uses the fix or says why it keeps the
workaround.
| Ref | Step in this document | Status | Issue |
|---|---|---|---|
| G1 | the 2026 loss ratio in section 5 | closed; bayes_new_year() used, which has no trend
(section 5 prints the gap) |
#598 |
| G2 | one program fitted under a fixed prior in sections 3 and 4, not several pooled | closed; bayes_hierarchical_bf() pools programs, and
this document still fits one program under a fixed prior |
#599 |
| G3 | one payment pattern for all simulations in section 7 | closed; each simulation pays on its own pattern,
monthly_pattern_draws(year_2026, ...)
|
#600 |
| G4 | the monthly patterns in section 7 | closed; monthly_pattern_draws() on the underwriting
basis used (section 7, #722) |
#601 |
| G5 | the loss ratio draws in section 4 | closed; loss_ratio_draws() used |
#602 |
| G6 | the deal’s paid against its simulations in section 10 | closed; deal_ave() used |
#603 |
| G7 | the prior inputs in section 3 | closed; industry_prior() used, on synthetic peers so
that the document needs no fetch |
#604 |
| G8 | the printout in section 11 | closed; the report tables and templates of
submission-schema.md
|
#605 |