A one-year view of a small P&C insurer
one_year_view.RmdRendered from examples/one_year_view.qmd.
The code runs each time the site is built, so the output below is
current.
This document uses prospicio end to end from R. It is
the R twin of one_year_view.ipynb,
with the same data, seeds and model. Its numbers agree with the numbers
of the notebook. It models three risks over the coming year, each with
its own method, and then puts them together:
- Reserve risk: the one-year view of the GenIns paid triangle. This is the claims development result over the coming year, from re-reserving inside an ODP bootstrap.
- Fleet motor premium risk: a Poisson GLM for claim frequency and a gamma GLM for severity on a policy file. They go into a collective model that carries the parameter uncertainty of the GLM.
- Property per-risk: a risk profile by sum-insured band. A surplus treaty inures to a per-risk excess of loss that has a paid reinstatement, pro rata as to time.
The document then does these steps:
- It prices the per-risk XL from its simulated losses and places it at that price.
- It joins the three risks with a rank correlation.
- It sets and allocates capital at TVaR 99%, gross and net of reinsurance. The net view pays what the reinsurance costs.
To run it, clone the repository and install the R package
(remotes::install_github, see
R/prospicio/bootstrap.R) and ggplot2. Then
render it from anywhere in the repository with
quarto render examples/one_year_view.qmd. Set the
environment variable PROSPICIO_EXAMPLE_SIMS to run fewer
simulations.
library(prospicio)
library(ggplot2)
N_SIMS <- as.integer(Sys.getenv("PROSPICIO_EXAMPLE_SIMS", "20000"))
# The repository's data folder, from wherever the document renders.
find_data <- function(start = getwd()) {
dir <- normalizePath(start, winslash = "/")
repeat {
candidate <- file.path(dir, "validation", "data")
if (dir.exists(candidate)) return(candidate)
parent <- dirname(dir)
if (identical(parent, dir)) stop("validation/data not found above ", start)
dir <- parent
}
}
DATA <- find_data()
read_data <- function(name) read.csv(file.path(DATA, name), comment.char = "#")
money <- function(x) sprintf("%.2fm", x / 1e6)1. Reserve risk
GenIns is a cumulative paid triangle, ten origin years by ten ages. The insurer already holds a reserve for these years. One-year capital must cover how far that reserve can deteriorate over the coming year. That amount is the claims development result (CDR): the estimate of the ultimate now, less the estimate a year from now. This is the one-year view of Merz and Wüthrich, on which a one-year capital standard such as Solvency II measures reserve risk. Development after the year gets its reserve at the end of the year, with the capital of that year.
odp_one_year() simulates the year by re-reserving. Each
simulation does these steps:
- It resamples the scaled Pearson residuals of the triangle.
- It draws the next diagonal with process noise.
- It appends the diagonal and fits the chain ladder again.
A negative CDR is an adverse development, so the loss of the reserve
line is minus the CDR. The code also prints the run-off view of the
bootstrap (odp_bootstrap()), the reserve until everything
is paid. The run-off view is wider, because it holds the development of
every future year and not only the next year.
tri <- read_triangle(file.path(DATA, "genins.csv"), "origin", "development", columns = "value", comment = "#")
one_year <- odp_one_year(tri, "value", method = "chain_ladder", n_sims = N_SIMS, seed = 1)
cdr <- total(one_year@cdr)
reserve <- sampled(-cdr@draws) # adverse development is the loss
run_off <- total(odp_bootstrap(tri, "value", n_sims = N_SIMS, seed = 1)@reserves)
cat(sprintf("opening reserve %s\n", money(sum(one_year@opening_reserve))))## opening reserve 18.68m
cat(sprintf("one-year: adverse development mean %s, sd %s, 99.5%% %s\n", money(mean(reserve)),
money(sqrt(variance(reserve))), money(quantile(reserve, 0.995))))## one-year: adverse development mean 0.10m, sd 2.41m, 99.5% 7.44m
cat(sprintf("run-off: reserve sd %s, 99.5%% %s above its mean\n", money(sqrt(variance(run_off))),
money(quantile(run_off, 0.995) - mean(run_off))))## run-off: reserve sd 3.00m, 99.5% 9.14m above its mean
2. Fleet motor premium risk
The policy file has 600 fleet policies with age, region, exposure and claims. Its amounts are in hundreds. Frequency is a Poisson GLM with log exposure as the offset. Severity is a gamma GLM on the average claim of each policy, weighted by its number of claims. So its dispersion is the squared CV of a single claim.
policies <- read_data("glm_policies.csv")
frequency <- glm_fit(claims ~ age + region + offset(log(exposure)), policies, family = "poisson")
print(round(data.frame(coefficient = coef(frequency), se = frequency@std_errors), 4))## coefficient se
## (Intercept) -0.3636 0.2394
## age -0.0105 0.0045
## regionB 0.0778 0.1921
## regionC -0.2581 0.2490
## regionD 0.2036 0.2448
policies$avg_claim <- 100 * policies$avg_sev
severity_fit <- glm_fit(avg_claim ~ 1, policies, family = "gamma", link = "log",
weights = policies$n_sev)
severity <- gamma_from_mean_cv(exp(coef(severity_fit)[[1]]), sqrt(severity_fit@dispersion))
cat(sprintf("mean claim %s, CV %.2f\n", format(round(mean(severity)), big.mark = ","),
sqrt(variance(severity)) / mean(severity)))## mean claim 106,806, CV 0.81
Next year every policy renews for a full year. The GLM gives a predictive distribution of the claim count of the book. It includes parameter uncertainty (coefficients drawn from their asymptotic normal) as well as Poisson noise. A negative binomial with the same mean and variance carries both into a collective model.
counts <- total(predict_distribution(frequency, transform(policies, exposure = 1), N_SIMS, 2))
count_model <- claim_count(mean(counts), variance(counts) / mean(counts))
motor <- total(total(simulate_events(count_model, severity, N_SIMS, 3)))
cat(sprintf("claims %.0f, Var/E %.2f\n", mean(counts), variance(counts) / mean(counts)))## claims 264, Var/E 2.76
## mean loss 28.19m, 99.5% 36.98m
3. Property per-risk
The profile has three bands of sum insured. Each band has its bounds, an expected loss and its own MBBEFD exposure curve (Swiss Re c = 2, 3, 4). Within a band, the risks spread evenly between the bounds.
The reinsurance has two stages:
- a surplus treaty with a 2m retention line and 4 lines (8m capacity)
- inuring to it, a per-risk XL of 3m xs 1m with one paid reinstatement at 100%, pro rata as to time
Two assumptions price the surplus: the original business runs at a 60% loss ratio, and the treaty pays a 35% ceding commission. A surplus treaty takes the same share of the premium of each risk as of its losses. So its ceded premium is its exposure-rated loss over 0.6.
The code sets the premium of the XL below, from its own simulated losses. The ceded losses of the XL do not depend on its premium, and its reinstatement premium is proportional to the premium. So this first run carries a deposit premium of 1 and reports the reinstatement premium per unit of deposit. The simulated losses have uniform dates over the year. So each reinstatement charge is for the part of the year left after the loss.
profile <- risk_profile(
sums_insured = c(0.5e6, 3e6, 15e6), risks = c(4000, 600, 60),
curves = list(swiss_re_curve(2), swiss_re_curve(3), swiss_re_curve(4)),
expected_loss = c(2.5e6, 2.0e6, 1.5e6),
lower = c(0.1e6, 1e6, 5e6), upper = c(1e6, 5e6, 25e6)
)
retention <- 2e6
lines <- 4
xl_limit <- 3e6
xl_attachment <- 1e6
original_loss_ratio <- 0.60 # assumptions
ceding_commission <- 0.35
xl_cost <- profile_layer_loss(profile, xl_limit, xl_attachment, retention, lines)
surplus <- surplus_treaty("surplus", retention, lines) |>
with_premium_rate(1, profile_surplus_loss(profile, retention, lines) / original_loss_ratio) |>
with_ceding_commission(ceding_commission)
per_risk_xl <- function(premium) {
xol_layer("per_risk_xl", xl_limit, xl_attachment, premium = premium,
reinstatement_rates = 1, pro_rata_time = TRUE)
}
events <- with_uniform_times(profile_simulate(profile, N_SIMS, 4))
result <- apply_tower(inuring_tower(list(list(surplus), list(per_risk_xl(1)))), events)
gross <- marginal(result, c("gross", "ground_up"))
net <- marginal(result, c("net", "retained"))
surplus_loss <- marginal(result, c("ceded", "surplus"))
xl_loss <- marginal(result, c("ceded", "per_risk_xl"))
reinstatement_rate <- mean(marginal(result, c("reinstatement_premium", "per_risk_xl")))
cat(sprintf("gross mean %s\n", money(mean(gross))))## gross mean 6.03m
cat(sprintf("surplus cedes %s (exposure rating %s)\n", money(mean(surplus_loss)),
money(profile_surplus_loss(profile, retention, lines))))## surplus cedes 1.50m (exposure rating 1.49m)
## per-risk XL 0.46m (exposure rating 0.45m)
## reinstatement premium 0.0747 per unit of deposit
## net mean 4.07m, 99.5% 14.26m
The simulated cessions agree with exposure rating, which checks the simulation. But the net 99.5% is high. The top band runs to 25m, past the 2m + 8m of the surplus, so its largest risks keep most of a total loss. More lines cut the net tail:
for (more in c(4, 8, 12)) {
alt <- apply_tower(
inuring_tower(list(list(surplus_treaty("surplus", retention, more)), list(per_risk_xl(1)))), events
)
cat(sprintf("%4.0f lines: net 99.5%% %s\n", more,
money(quantile(marginal(alt, c("net", "retained")), 0.995))))
}## 4 lines: net 99.5% 14.26m
## 8 lines: net 99.5% 8.15m
## 12 lines: net 99.5% 7.70m
Pricing the XL from its simulated losses: assets at TVaR 99%, and a 10% cost of capital on the capital above the premium. That risk-loaded premium is what the reinsurer should collect in total: the deposit plus the reinstatement premiums that it expects. Those are the deposit times the rate per unit that the run above measured. So the deposit is the risk-loaded premium divided by one plus that rate. This is exact in one step, with no iteration: the price depends only on the ceded losses, and they do not depend on the premium.
The code then applies the tower again with that deposit. So the reinstatement premiums that the cedant pays follow the premium that the document prices. For comparison, the code prints the exposure-rated cost over a 70% loss ratio.
xl_price <- risk_loaded_price(xl_loss, distortion("tvar", 0.99), cost_of_capital = 0.10)
xl <- per_risk_xl(xl_price$premium / (1 + reinstatement_rate))
tower <- inuring_tower(list(list(surplus), list(xl)))
result <- apply_tower(tower, events)
reinstated <- marginal(result, c("reinstatement_premium", "per_risk_xl"))
cat(sprintf("risk-loaded premium %s, capital %s\n", money(xl_price$premium), money(xl_price$capital)))## risk-loaded premium 0.81m, capital 3.51m
cat(sprintf("deposit %s + expected reinstatements %s\n", money(xl@premium), money(mean(reinstated))))## deposit 0.75m + expected reinstatements 0.06m
## (exposure-rated cost over a 70% loss ratio: 0.64m)
What the reinsurance costs. In each simulated year, the cedant pays:
- the ceded premium of the surplus, less its ceding commission
- the deposit of the XL
- the reinstatement premiums that the losses of that year trigger
The property line net of reinsurance is the retained loss plus that cost. On average, the cedant pays more than it recovers, by the margin of the reinsurers. That difference is the expected cost of the cover.
commission <- marginal(result, c("ceding_commission", "surplus"))
paid <- surplus@premium - commission@draws + xl@premium + reinstated@draws
net_of_cost <- sampled(net@draws + paid)
recovered <- mean(surplus_loss) + mean(xl_loss)
reinsurance_cost <- mean(net_of_cost) - mean(gross)
cat(sprintf("surplus premium %s less commission %s\n", money(surplus@premium), money(mean(commission))))## surplus premium 2.48m less commission 0.87m
## XL deposit 0.75m and reinstatements 0.06m
cat(sprintf("paid %s, recovered %s, expected cost %s\n", money(mean(paid)), money(recovered),
money(reinsurance_cost)))## paid 2.42m, recovered 1.96m, expected cost 0.46m
4. The company
The code joins the three lines into one
predictive_distribution. Each line has its own simulation,
so Iman-Conover reorders the draws to a rank correlation. The
correlation is 0.4 between reserve and motor (shared claims inflation)
and 0.1 for property. The code then allocates TVaR 99% of the losses of
the year by Euler (the CoTVaR of each line). It does this gross and net
of the property reinsurance, and the net view includes its cost.
Both views leave out premium income. The premiums of next year are the same gross and net, so the premium lines carry their losses. The reserve is already held, so it carries only its one-year change.
corr <- matrix(c(1.0, 0.4, 0.1,
0.4, 1.0, 0.1,
0.1, 0.1, 1.0), nrow = 3, byrow = TRUE)
company <- function(property_line) {
parts <- predictive_distribution(
cbind(reserve@draws, motor@draws, property_line@draws),
data.frame(risk = c("reserve", "motor", "property"))
)
iman_conover(parts, corr, seed = 5)
}
tvar <- distortion("tvar", 0.99)
companies <- list(gross = company(gross), net = company(net_of_cost))
allocations <- lapply(companies, capital_allocation, distortion = tvar)
by_line <- data.frame(
risk = allocations$gross$by_component$risk,
gross = allocations$gross$by_component$allocated,
net = allocations$net$by_component$allocated
)
summary_table <- rbind(
by_line,
data.frame(risk = c("total", "diversif."),
gross = c(allocations$gross$total, allocations$gross$diversification_benefit),
net = c(allocations$net$total, allocations$net$diversification_benefit))
)
summary_table[c("gross", "net")] <- lapply(summary_table[c("gross", "net")], money)
summary_table## risk gross net
## 1 reserve 2.33m 4.62m
## 2 motor 31.35m 34.15m
## 3 property 25.65m 12.50m
## 4 total 59.33m 51.27m
## 5 diversif. 13.64m 11.36m
saved <- allocations$gross$total - allocations$net$total
retained_only <- capital_allocation(company(net), distortion = tvar)$total
cat(sprintf("reinsurance cuts the company's TVaR by %s, net of its cost\n", money(saved)))## reinsurance cuts the company's TVaR by 8.06m, net of its cost
cat(sprintf("it costs %s a year, %.1f%% of the TVaR it saves\n", money(reinsurance_cost),
100 * reinsurance_cost / saved))## it costs 0.46m a year, 5.8% of the TVaR it saves
cat(sprintf("(leaving its cost out, the cut would read %s)\n",
money(allocations$gross$total - retained_only)))## (leaving its cost out, the cut would read 10.67m)
The charts below show the distribution of the total of the company, gross and net, and the share of each line in TVaR 99%.
total_draws <- function(pd) rowSums(draw_matrix(pd)) / 1e6
loss_draws <- rbind(
data.frame(view = "gross", loss = total_draws(companies$gross)),
data.frame(view = "net", loss = total_draws(companies$net))
)
ggplot(loss_draws, aes(loss, colour = view)) +
geom_freqpoly(aes(y = after_stat(density)), bins = 80) +
labs(x = "company loss (m)", y = "density", title = "Year's total loss")
allocated <- rbind(
data.frame(view = "gross", risk = by_line$risk, cotvar = by_line$gross / 1e6),
data.frame(view = "net", risk = by_line$risk, cotvar = by_line$net / 1e6)
)
ggplot(allocated, aes(risk, cotvar, fill = view)) +
geom_col(position = "dodge") +
labs(x = NULL, y = "CoTVaR 99% (m)", title = "TVaR 99% by line")
Reading the result
- Motor dominates the tail, gross and net: it carries a whole year of claims and their uncertainty.
- The reserve’s one-year risk is small beside it. The opening reserve is already held, so only its deterioration over the year needs capital. That deterioration is narrower than the spread of the run-off view.
- Reinsurance cuts property’s CoTVaR by about half, even after its cost. The company’s TVaR falls by less than that, because property’s tail was partly diversified already.
- Reserve and motor take more of the net TVaR than of the gross. After reinsurance covers the extreme years of property, reserve and motor drive the worst years of the company.
- The reinsurance costs less than the cost of holding the capital that it frees. Here, its expected cost is about 6% of the TVaR it removes, below the 10% cost of capital in the XL price. That is about 0.46m a year against 10% of 8.06m, about 0.81m. Leaving the cost out would overstate the saving by about what the cedant pays for the cover. A fixed premium adds in full to TVaR.