Property catastrophe 4: stacked covers, and who keeps what
cat-4-programs.RmdRendered from docs/guides/cat-4-programs.qmd.
The code runs each time the site is built, so the output below is
current.
A cedent seldom buys one layer. It buys a program: several layers on the same losses, sometimes behind a quota share, sometimes with a peril excluded. A reinsurer signs a line, a share of each layer, next to other markets, and can buy its own cover, a retro. Each party sees the same years of losses from a different position.
This page builds these views on the Larkspur Re book: the two layers of Alder Mutual together, the quota share of Corran General ahead of a cat cover, the losses of Bracken split by what its aggregate cover can reach, and a small retro for Larkspur.
The contract terms come from
examples/data/cat_book_contracts.csv. Larkspur does not
write two covers on this page, the cat cover of Corran and its own
retro. They are hypothetical. The story, the files and the notation are
on the overview. Read page 3 first for a single layer,
the hours clause and reinstatements.
This is the R twin of the Python guide cat-4-programs.md,
with the same sections, files and numbers. The text under each R chunk
is what the chunk prints, and
R/prospicio/tests/test-guides.R checks it. The whole page
runs in a few seconds.
1. The book and the helpers
The year event loss table (YELT) has one row per cedent per event
piece. cedent_events() makes an event_set from
the rows of one cedent, with event times and a peril label.
contract_layer() makes an xol_layer from a row
of the contracts file. subject() applies the peril scope
and the hours clause of the contract. ceded_of() reads the
ceded loss of one layer from the result of a tower (prospicio already
uses the name ceded for a function on the losses of one
year).
library(prospicio)
# The data files, found from the repository root (CI) or from docs/guides (Quarto).
find_data <- function(name, dir = getwd()) {
repeat {
path <- file.path(dir, "examples", "data", name)
if (file.exists(path)) return(path)
parent <- dirname(dir)
if (identical(parent, dir)) stop("examples/data/", name, " not found", call. = FALSE)
dir <- parent
}
}
read_text <- function(name) {
utils::read.csv(find_data(name), colClasses = "character", na.strings = character())
}
yelt <- utils::read.csv(find_data("cat_book_yelt.csv"), stringsAsFactors = FALSE)
contracts <- read_text("cat_book_contracts.csv")
contracts <- stats::setNames(split(contracts, seq_len(nrow(contracts))), contracts$contract)
cedents <- read_text("cat_book_cedents.csv")
n_years <- 2000
# One cedent's years of losses, with times (fraction of the year) and peril labels.
cedent_events <- function(cedent, perils = "all") {
rows <- yelt[yelt$cedent == cedent, ]
if (perils != "all") rows <- rows[rows$peril %in% strsplit(perils, "+", fixed = TRUE)[[1]], ]
year <- factor(rows$year, levels = seq_len(n_years))
time <- ((rows$day - 1) * 24 + rows$hour) / 8760
ev <- events_from_years(unname(split(rows$loss, year)), times = unname(split(time, year)))
with_labels(ev, list(peril = rows$peril))
}
num <- function(x, default = NULL) if (nzchar(x)) as.numeric(x) else default
# A row of the contracts file as a layer: Larkspur's line, premium and terms.
contract_layer <- function(c) {
share <- num(c$share)
if (c$kind == "occurrence_xl") {
limit <- num(c$limit)
return(xol_layer(c$contract, limit, num(c$attachment), share = share,
premium = num(c$rate_on_line) * limit * share,
reinstatement_rates = rep(num(c$reinstatement_rate), as.integer(c$reinstatements))))
}
if (c$kind == "aggregate_xl") {
agg_limit <- num(c$aggregate_limit)
return(xol_layer(c$contract, Inf, 0, share = share,
aggregate_deductible = num(c$aggregate_deductible), aggregate_limit = agg_limit,
premium = num(c$rate_on_line) * agg_limit * share))
}
premium <- share * as.numeric(cedents$cat_premium[cedents$cedent == c$cedent])
with_ceding_commission(
xol_layer(c$contract, num(c$limit), 0, share = share,
aggregate_limit = num(c$aggregate_limit, Inf), premium = premium),
num(c$ceding_commission))
}
# The losses a contract sees: its perils, grouped by its hours clause.
subject <- function(c) {
e <- cedent_events(c$cedent, c$perils)
if (nzchar(c$hours)) hours_clause(e, as.numeric(c$hours)) else e
}
# One layer's ceded loss from a tower result.
ceded_of <- function(res, name) {
marginal(aggregate(res, keep = c("kind", "layer")), list(kind = "ceded", layer = name))
}
for (c in contracts) {
cat(sprintf("%-12s %-14s perils %-5s share %s\n", c$contract, c$kind, c$perils, c$share))
}## alder_cat_1 occurrence_xl perils all share 0.3
## alder_cat_2 occurrence_xl perils all share 0.2
## bracken_cat occurrence_xl perils all share 0.25
## bracken_agg aggregate_xl perils CS+FL share 0.25
## corran_qs quota_share perils all share 0.1
2. A program: two layers on one subject
Alder buys 40 xs 30 and 100 xs 70. The layers touch: the first layer
exhausts where the second attaches. A reinsurance_tower()
applies both layers to the same occurrences in one pass and uses up the
reinstatements of each layer in event order.
Both contracts of Alder have a 72 hour clause and cover all perils,
so they share one subject. aggregate(res, keep = "kind")
adds the layers and leaves four components: the gross loss, the ceded
loss, the net loss and the reinstatement premium.
library(gt)
alder <- subject(contracts$alder_cat_1)
cat_1 <- contract_layer(contracts$alder_cat_1)
cat_2 <- contract_layer(contracts$alder_cat_2)
program <- reinsurance_tower(list(cat_1, cat_2))
res <- apply_tower(program, alder)
by_kind <- aggregate(res, keep = "kind")
program_means <- data.frame(
item = c(by_kind@keys$kind, paste("ceded", program@layer_names)),
mean = c(vapply(by_kind@keys$kind, function(k) mean(marginal(by_kind, list(kind = k))), numeric(1)),
vapply(program@layer_names, function(n) mean(ceded_of(res, n)), numeric(1)))
)
gt(program_means, rowname_col = "item") |>
tab_header("Alder's program, Larkspur's lines (30% and 20%)", "Mean a year, millions") |>
fmt_number(columns = mean, decimals = 4)| Alder's program, Larkspur's lines (30% and 20%) | |
| Mean a year, millions | |
| mean | |
|---|---|
| gross | 16.7784 |
| ceded | 1.2392 |
| net | 15.5392 |
| reinstatement_premium | 0.1410 |
| ceded alder_cat_1 | 0.8230 |
| ceded alder_cat_2 | 0.4163 |
Gross is ceded plus net in every year, and thus also in the mean. The ceded loss here is the line of Larkspur on each layer, not the whole layer (section 4). The net is net of recoveries only. Alder also pays the reinstatement premium of 0.1410 (page 5).
3. What adds up and what does not
Expected losses add across layers. Tail measures do not: the TVaR at 99% of a sum is at most the sum of the TVaRs, and smaller when the worst years of the parts differ. For two layers on one subject the worst years overlap a lot, because a large occurrence fills both, but not fully: two moderate events can fill the first layer and not touch the second.
c1 <- ceded_of(res, "alder_cat_1")
c2 <- ceded_of(res, "alder_cat_2")
both <- sampled(c1@draws + c2@draws)
additivity <- data.frame(
measure = c("alder_cat_1", "alder_cat_2", "sum of the two", "the program"),
mean = c(mean(c1), mean(c2), mean(c1) + mean(c2), mean(both)),
tvar_99 = c(TVaR(c1, 0.99), TVaR(c2, 0.99), TVaR(c1, 0.99) + TVaR(c2, 0.99), TVaR(both, 0.99))
)
gt(additivity, rowname_col = "measure") |>
tab_header("Larkspur's ceded loss: the mean adds, the TVaR does not",
"Millions a year, 2,000 simulated years") |>
cols_label(mean = "mean", tvar_99 = "TVaR 99%") |>
fmt_number(columns = mean, decimals = 4) |>
fmt_number(columns = tvar_99, decimals = 3)| Larkspur's ceded loss: the mean adds, the TVaR does not | ||
| Millions a year, 2,000 simulated years | ||
| mean | TVaR 99% | |
|---|---|---|
| alder_cat_1 | 0.8230 | 13.843 |
| alder_cat_2 | 0.4163 | 20.998 |
| sum of the two | 1.2392 | 34.841 |
| the program | 1.2392 | 33.983 |
The gap, 0.858, is a small diversification credit inside the program of one cedent. Across cedents and perils it is much larger. Page 7 (the portfolio) measures it on the whole book.
4. Whose line? Participation
The share of an xol_layer() is the line
that the modelled party signs. With share = 0.3, the tower
reports 30% of the layer loss as ceded and all the rest as net. This
“net” is the loss of the cedent less the part of Larkspur only, not the
true retention of the cedent. Other reinsurers take the other 70% of the
layer, and they are not in this model.
To see the program as Alder sees it, model each layer at 100%. A share scales the layer loss in every year, so the 100% layer is the line divided by the share.
# The whole layer: the contract's terms without Larkspur's share.
at_100 <- function(c) {
xol_layer(c$contract, num(c$limit), num(c$attachment),
reinstatement_rates = rep(num(c$reinstatement_rate), as.integer(c$reinstatements)))
}
full <- reinsurance_tower(list(at_100(contracts$alder_cat_1), at_100(contracts$alder_cat_2)))
alder_view <- aggregate(apply_tower(full, alder), keep = "kind")
kinds <- c("gross", "ceded", "net")
views <- data.frame(
kind = kinds,
alder = vapply(kinds, function(k) mean(marginal(alder_view, list(kind = k))), numeric(1)),
larkspur = vapply(kinds, function(k) mean(marginal(by_kind, list(kind = k))), numeric(1))
)
gt(views, rowname_col = "kind") |>
tab_header("The program at 100% and at Larkspur's lines", "Mean a year, millions") |>
cols_label(alder = "Alder, 100%", larkspur = "Larkspur's lines") |>
fmt_number(columns = c(alder, larkspur), decimals = 4)| The program at 100% and at Larkspur's lines | ||
| Mean a year, millions | ||
| Alder, 100% | Larkspur's lines | |
|---|---|---|
| gross | 16.7784 | 16.7784 |
| ceded | 4.8246 | 1.2392 |
| net | 11.9538 | 15.5392 |
line <- sum(vapply(program@layer_names, function(n) {
mean(ceded_of(res, n)) / num(contracts[[n]]$share)
}, numeric(1)))
cat(sprintf("Larkspur's lines grossed up to 100%%: %.4f\n", line))## Larkspur's lines grossed up to 100%: 4.8246
When a later page adds the deals of Larkspur, the lines of Larkspur add up, never the 100% layers.
5. Inuring: a quota share ahead of a cat cover
Corran General cedes 10% of each occurrence to Larkspur under the
quota share corran_qs, with an event limit of 150 and an
annual limit of 300. Suppose that Corran also buys a cat cover of 60 xs
20 for its own retention. The quota share inures to the benefit of the
cat cover: the cat layer sees each occurrence after the quota share
takes its part.
For one occurrence of size X and the quota share cession
Q(X), the cat layer cedes
C = min(max(X - Q(X) - 20, 0), 60)
Q(X) is 10% of X, capped at the event
limit, and zero after the quota share uses up its annual limit. Thus
Q also depends on the earlier occurrences of the year.
inuring_tower() takes the stages in order. Each stage
sees the losses net of all earlier stages, event by event, and the
stages use up annual limits in event order.
corran <- subject(contracts$corran_qs)
qs <- contract_layer(contracts$corran_qs)
inuring <- apply_tower(inuring_tower(list(list(qs), list(xol_layer("corran_cat", 60, 20)))), corran)
keys <- inuring@keys
stages <- data.frame(
component = paste(keys$kind, keys$layer),
mean = vapply(seq_len(nrow(keys)), function(i) {
mean(marginal(inuring, list(kind = keys$kind[i], layer = keys$layer[i])))
}, numeric(1))
)
gt(stages, rowname_col = "component") |>
tab_header("Corran: quota share, then cat cover", "Mean a year, millions") |>
fmt_number(columns = mean, decimals = 4)| Corran: quota share, then cat cover | |
| Mean a year, millions | |
| mean | |
|---|---|
| gross ground_up | 13.0490 |
| ceded corran_qs | 1.2025 |
| ceded corran_cat | 2.6164 |
| net retained | 9.2301 |
| ceding_commission corran_qs | 0.7500 |
alone <- apply_tower(reinsurance_tower(list(xol_layer("corran_cat", 60, 20))), corran)
cat(sprintf("cat cover on the gross, no quota share ahead: %.4f\n",
mean(ceded_of(alone, "corran_cat"))))## cat cover on the gross, no quota share ahead: 2.9890
The quota share takes slightly less than 10% of the gross (1.2025 against 1.3049) because of its event and annual limits. With the quota share ahead, the expected loss of the cat cover falls from 2.989 to 2.616, so the cat reinsurer should charge less. The ceding commission is 25% of the quota share premium of 3.0, a fixed 0.75 in every year.
6. What Bracken’s aggregate cover can reach
For Bracken, the aggregate cover bracken_agg splits the
gross loss into these amounts:
- Gross: all the losses of Bracken.
- Subject: the losses that the contract applies to (page 3, section 5), here convective storm and flood only.
- Ceded: what the whole contract pays, at 100%.
- Retained: subject less ceded, what Bracken keeps of the losses that the contract can pay.
The gross less the subject is outside the scope of the contract. Windstorm and earthquake are excluded perils for this cover, and no change to its deductible or limit can reach them. As in section 4, the page models the contract at 100%, so “retained” is what Bracken keeps, not the subject less the line of Larkspur.
bc <- contracts$bracken_agg
gross_mean <- mean(total(cedent_events("bracken")))
subj <- subject(bc)
whole <- xol_layer(bc$contract, Inf, 0, aggregate_deductible = num(bc$aggregate_deductible),
aggregate_limit = num(bc$aggregate_limit))
agg <- apply_tower(reinsurance_tower(list(whole)), subj)
subject_mean <- mean(total(subj))
ceded_mean <- mean(ceded_of(agg, "bracken_agg"))
reach <- data.frame(
amount = c("gross", "subject", "ceded, 100%", "retained", "outside the scope",
"Larkspur's 25% of ceded"),
mean = c(gross_mean, subject_mean, ceded_mean, subject_mean - ceded_mean,
gross_mean - subject_mean, ceded_mean * num(bc$share))
)
gt(reach, rowname_col = "amount") |>
tab_header("Bracken's aggregate cover: what it can reach", "Mean a year, millions") |>
fmt_number(columns = mean, decimals = 4)| Bracken's aggregate cover: what it can reach | |
| Mean a year, millions | |
| mean | |
|---|---|
| gross | 15.3765 |
| subject | 7.1642 |
| ceded, 100% | 0.6484 |
| retained | 6.5158 |
| outside the scope | 8.2122 |
| Larkspur's 25% of ceded | 0.1621 |
More than half of the loss of Bracken is windstorm and earthquake,
outside the scope of this contract. The occurrence layer
bracken_cat covers those losses.
7. Splitting a program by peril
With peril labels on the events, the result of a tower has a third
dimension, peril, next to kind and
layer. It answers “how much of the ceded loss is
windstorm?”. hours_clause() removes the labels, so this
section uses the grouped_by_peril() helper of page 3,
section 2, repeated here so that the page runs on its own.
grouped_by_peril <- function(cedent, hours) {
out <- NULL
for (p in c("WS", "EQ", "FL", "CS")) {
g <- hours_clause(cedent_events(cedent, p), hours)
g <- with_labels(g, list(peril = rep(p, sum(event_counts(g)))))
out <- if (is.null(out)) g else merge_event_sets(out, g)
}
out
}
by_peril <- aggregate(apply_tower(program, grouped_by_peril("alder", 72)), keep = c("kind", "peril"))
perils <- c("WS", "EQ", "FL", "CS")
split_peril <- data.frame(
peril = perils,
gross = vapply(perils, function(p) mean(marginal(by_peril, list(kind = "gross", peril = p))), numeric(1)),
ceded = vapply(perils, function(p) mean(marginal(by_peril, list(kind = "ceded", peril = p))), numeric(1))
)
gt(split_peril, rowname_col = "peril") |>
tab_header("Alder's program by peril", "Mean a year, millions; ceded is Larkspur's lines") |>
fmt_number(columns = c(gross, ceded), decimals = 4)| Alder's program by peril | ||
| Mean a year, millions; ceded is Larkspur's lines | ||
| gross | ceded | |
|---|---|---|
| WS | 9.9146 | 0.8825 |
| EQ | 2.4733 | 0.2800 |
| FL | 3.0416 | 0.0759 |
| CS | 1.3489 | 0.0000 |
cat(sprintf("ceded, all perils: %.4f\n",
mean(marginal(aggregate(by_peril, keep = "kind"), list(kind = "ceded")))))## ceded, all perils: 1.2385
The figure shows the same split:
library(ggplot2, exclude = "layer") # keeps prospicio's layer()
split <- data.frame(
peril = factor(rep(perils, 2), levels = perils),
measure = factor(rep(c("gross", "ceded to Larkspur"), each = 4),
levels = c("gross", "ceded to Larkspur")),
mean = c(split_peril$gross, split_peril$ceded)
)
ggplot(split, aes(peril, mean, fill = measure)) +
geom_col(position = position_dodge(width = 0.8), width = 0.7) +
scale_fill_manual(values = c("gross" = "grey75", "ceded to Larkspur" = scales::hue_pal()(1))) +
labs(x = "peril (WS windstorm, EQ earthquake, FL flood, CS convective storm)",
y = "mean loss a year (millions)", fill = NULL,
title = "Alder's program by peril: gross and ceded loss") +
theme(legend.position = "top")Windstorm drives the program. No convective storm occurrence of Alder reaches the attachment of 30, even after grouping.
The ceded total, 1.2385, is not quite the 1.2392 of section 2: here a windstorm and a flood in the same three days stay two occurrences. Page 3, section 2 explains why the track prices with the all-perils clause and uses the per-peril grouping only for splits like this one.
8. Retro as an aggregate cover
The simplest retro is an aggregate stop loss on the annual total of
what Larkspur wrote. Here Larkspur buys 10 xs 8 on the annual total of
two deals: its lines on alder_cat_1 and
bracken_cat.
A deal is one contract as Larkspur wrote it: the
premium, losses and other flows of its line, year by year.
deal_run_from_tower() records one layer of a tower result
as a deal, and deal_book() aligns the deals by year.
book_amounts() also holds a "total" deal, so
select the deals by name. apply_tower() on a predictive
distribution then treats the total of the selection in each year as one
aggregate loss.
bc <- contracts$bracken_cat
bracken_tower <- reinsurance_tower(list(contract_layer(bc)))
alder_tower <- reinsurance_tower(list(cat_1))
deals <- c("alder_cat_1", "bracken_cat")
book <- deal_book(list(
deal_run_from_tower("alder_cat_1", alder_tower, apply_tower(alder_tower, alder), "alder_cat_1"),
deal_run_from_tower("bracken_cat", bracken_tower, apply_tower(bracken_tower, subject(bc)), "bracken_cat")
))
losses <- select_components(select_components(book_amounts(book), "item", "loss"), "deal", deals)
annual <- total(losses)
cat(sprintf("book loss mean %.4f, P(loss > 8) %.4f\n", mean(annual), sum(annual@draws > 8) / n_years))## book loss mean 1.5077, P(loss > 8) 0.0835
retro <- apply_tower(reinsurance_tower(list(aggregate_stop_loss("retro", 10, 8))), losses)
cat(sprintf("retro 10 xs 8 ceded mean %.4f\n", mean(ceded_of(retro, "retro"))))## retro 10 xs 8 ceded mean 0.4565
In about one year in twelve the two deals lose more than 8, where the retro starts to pay. Its expected recovery is close to a third of the mean loss of the deals: the cover sits where these thin, volatile lines put their losses.
For a per-occurrence retro, ceded_by_event() gives the
ceded amount of each event for one list of losses (#590).
In Python
The Python guide, cat-4-programs.md,
runs the same steps with Tower, Tower.inuring,
Tower.apply, EventSet.merge,
DealRun.from_tower, DealBook,
DealBook.amounts and Layer.stop_loss.
Further reading
Page 5 adds the flows other than loss: reinstatement premium, commissions and brokerage. reinsurance.dev by Oliver Baltzer is another introduction to property catastrophe reinsurance.