Price allocation in practice: the case-study tables and the reinsurance decision
pir-price-allocation-practice.RmdRendered from docs/guides/pir-price-allocation-practice.qmd.
The code runs each time the site is built, so the output below is
current.
This guide continues Price
allocation in Pricing Insurance Risk on a realistic book,
the Cat/Non-Cat case study of Mildenhall and Major’s Pricing
Insurance Risk (Wiley, 2022). Section 2 allocates it by the
classical recipes of chapter 13 (Table 13.3). Section 3 uses the natural
allocation and Bodoff’s percentile layer of capital of chapter 15
(Tables 15.36 and 15.39). Section 4 is the chapter 19 test of whether a
reinsurance cover is worth buying. Each number that the book prints is
shown next to the number from prospicio. Pricing
Insurance Risk: the case studies compares the same case studies with
aggregate 0.30.1.
This is the R twin of the Python guide pir-price-allocation-practice.md,
with the same sections, examples and numbers. The R package calls the
same Rust code, so each number equals the one in the Python guide. The
text under each R chunk is what it prints;
R/prospicio/tests/test-guides.R runs the chunks in order
and requires that output.
1. The book and its capital standard
Cat/Non-Cat has two independent units with a total mean of 100:
Non-Cat is a gamma (mean 80, CV 0.15) and Cat is a lognormal (mean 20,
CV 1). As in the case studies guide, the code puts each unit on the grid
of aggregate (step 1/64, 2^16 points), combines the units
by FFT, sets the assets to the 99.9% quantile of the total and
calibrates five distortions to a 10% return on capital:
library(prospicio)
FAMILIES <- c("ccoc", "ph", "wang", "dual", "tvar")
STEP <- 1 / 64
POINTS <- 2^16
# A severity on a grid, its mass above the top spread over the grid as aggregate does.
discretize_renormalized <- function(severity, step, points) {
probs <- discretize(severity, step, 2 * points, method = "rounding")@probs[seq_len(points)]
grid_distribution(step, probs / sum(probs))
}
cat_unit <- discretize_renormalized(lognormal_from_mean_cv(20, 1.0), STEP, POINTS)
noncat <- discretize_renormalized(gamma_from_mean_cv(80, 0.15), STEP, POINTS)
book <- capital_portfolio(list(Cat = cat_unit, NonCat = noncat))
a <- portfolio_assets(book, 0.999)
capped <- capital_portfolio(cbind(total = pmin(book@totals, a)), probs = book@probs)
dists <- setNames(lapply(FAMILIES, function(f) {
calibrate_portfolio(capped, f, assets = a, return_on_capital = 0.10)
}), FAMILIES)
loss <- natural_price(book, dists$ccoc, p = 0.999)$loss[1:2]
cat(sprintf("assets %.2f (book 267.2)\n", a))## assets 267.20 (book 267.2)
cat(sprintf("expected loss within the assets: Cat %.2f, Non-Cat %.2f (book 19.96, 79.99)\n", loss[1], loss[2]))## expected loss within the assets: Cat 19.96, Non-Cat 79.99 (book 19.96, 79.99)
Calibrating on the capped total gives the same parameters as on the full portfolio.
2. Allocated CCoC pricing (Table 13.3)
Chapter 13 allocates the 267.2 of assets to the units and charges a
10% return on the capital of each unit. The margin of a unit is
0.1 / 1.1 times its assets minus its expected loss, so the
result depends on the asset allocation. The chapter uses nine
methods:
- expected loss: assets in proportion to expected loss.
- scaled VaR, TVaR and EPD: the stand-alone VaR, TVaR or EPD-based assets of each unit, scaled to add up to 267.2. For TVaR and EPD, the level is the one at which the measure of the total gives 267.2.
- equal risk VaR, TVaR and EPD: the one level at which the stand-alone measures of the units add up to 267.2.
- coTVaR: the average loss of each unit in the years beyond the level at which the TVaR of the total is 267.2.
-
covariance:
ksuch thatE[X] + k Var(X)is 267.2. UnitigetsE[X_i] + k Cov(X_i, X).
A recipe that must find a level uses a bisection:
# The root of an increasing function f between lo and hi, by bisection.
solve <- function(f, lo, hi, steps = 100) {
for (i in seq_len(steps)) {
mid <- (lo + hi) / 2
if (f(mid) > 0) hi <- mid else lo <- mid
}
(lo + hi) / 2
}
probs <- numeric(round(max(book@totals) / STEP) + 1)
idx <- round(book@totals / STEP) + 1
probs[idx] <- probs[idx] + book@probs
total <- grid_distribution(STEP, probs)
units <- list(cat_unit, noncat)
# The assets at which a unit's expected shortfall is epd times its mean.
epd_assets <- function(g, epd) solve(function(x) epd - stop_loss(g, x) / mean(g), 0, POINTS * STEP)
p_tvar <- solve(function(p) TVaR(total, p) - a, 0.5, 0.999)
epd_total <- stop_loss(total, a) / mean(total)
p_var <- solve(function(p) quantile(cat_unit, p) + quantile(noncat, p) - a, 0.9, 0.99999)
p_eq_tvar <- solve(function(p) TVaR(cat_unit, p) + TVaR(noncat, p) - a, 0.5, 0.99999)
log_epd <- solve(function(e) a - sum(sapply(units, epd_assets, epd = 10^e)), -14, 0, 60)
k <- (a - mean(total)) / variance(total)
scaled <- function(values) a * values / sum(values)
ASSETS <- list(
"expected loss" = scaled(loss),
"scaled EPD" = scaled(sapply(units, epd_assets, epd = epd_total)),
"scaled TVaR" = scaled(sapply(units, TVaR, p = p_tvar)),
"scaled VaR" = scaled(sapply(units, quantile, probs = 0.999)),
"equal risk EPD" = sapply(units, epd_assets, epd = 10^log_epd),
"equal risk TVaR" = sapply(units, TVaR, p = p_eq_tvar),
"equal risk VaR" = sapply(units, quantile, probs = p_var),
"coTVaR" = natural_price(book, distortion("tvar", p_tvar))$premium[1:2],
"covariance" = sapply(units, function(g) mean(g) + k * variance(g))
)
BOOK_133 <- list( # Table 13.3, gross margin: (Cat, Non-Cat)
"expected loss" = c(3.04, 12.17), "scaled EPD" = c(15.68, -0.471), "scaled TVaR" = c(12.85, 2.36),
"scaled VaR" = c(12.82, 2.38), "equal risk EPD" = c(13.33, 1.87), "equal risk TVaR" = c(11.78, 3.42),
"equal risk VaR" = c(11.74, 3.47), "coTVaR" = c(14.84, 0.37), "covariance" = c(11.18, 4.03)
)
cat(sprintf("levels: TVaR %.4f, equal risk VaR %.4f, equal risk TVaR %.4f\n", p_tvar, p_var, p_eq_tvar))## levels: TVaR 0.9970, equal risk VaR 0.9977, equal risk TVaR 0.9931
library(gt)
d <- 0.1 / 1.1
table_133 <- do.call(rbind, lapply(names(ASSETS), function(method) {
assets <- ASSETS[[method]]
margin <- d * (assets - loss)
data.frame(recipe = method, assets = assets[1], cat = margin[1], cat_book = BOOK_133[[method]][1],
noncat = margin[2], noncat_book = BOOK_133[[method]][2])
}))
gt(table_133, rowname_col = "recipe") |>
tab_header("Table 13.3: allocated CCoC margins",
"Margin of each unit, prospicio and the book; currency units") |>
tab_spanner("Cat margin", columns = c(cat, cat_book)) |>
tab_spanner("Non-Cat margin", columns = c(noncat, noncat_book)) |>
cols_label(assets = "Cat assets", cat = "prospicio", cat_book = "book",
noncat = "prospicio", noncat_book = "book") |>
fmt_number(columns = assets, decimals = 2) |>
fmt_number(columns = c(cat, noncat), decimals = 3) |>
fmt_number(columns = c(cat_book, noncat_book), decimals = 3, drop_trailing_zeros = TRUE)| Table 13.3: allocated CCoC margins | |||||
| Margin of each unit, prospicio and the book; currency units | |||||
| Cat assets |
Cat margin
|
Non-Cat margin
|
|||
|---|---|---|---|---|---|
| prospicio | book | prospicio | book | ||
| expected loss | 53.36 | 3.036 | 3.04 | 12.169 | 12.17 |
| scaled EPD | 192.38 | 15.675 | 15.68 | −0.470 | −0.471 |
| scaled TVaR | 161.25 | 12.845 | 12.85 | 2.361 | 2.36 |
| scaled VaR | 160.98 | 12.821 | 12.82 | 2.385 | 2.38 |
| equal risk EPD | 166.64 | 13.335 | 13.33 | 1.870 | 1.87 |
| equal risk TVaR | 149.59 | 11.785 | 11.78 | 3.420 | 3.42 |
| equal risk VaR | 149.06 | 11.737 | 11.74 | 3.470 | 3.47 |
| coTVaR | 183.15 | 14.835 | 14.84 | 0.370 | 0.37 |
| covariance | 142.93 | 11.179 | 11.18 | 4.026 | 4.03 |
Sixteen of the eighteen margins match the book to the digits that it prints. The other two, Cat’s scaled TVaR and scaled EPD margins, are within 0.005 of the printed value, on the rounding boundary. The two bars of a recipe add up to 15.2:
library(ggplot2, exclude = "layer") # keeps prospicio's layer()
methods <- names(ASSETS)
margins <- do.call(rbind, lapply(methods, function(m) {
data.frame(method = m, unit = c("Cat", "Non-Cat"), margin = d * (ASSETS[[m]] - loss))
}))
margins$method <- factor(margins$method, levels = rev(methods))
ggplot(margins, aes(margin, method, fill = unit)) +
geom_col(position = position_dodge(width = 0.8), width = 0.7) +
geom_vline(xintercept = 0, colour = "grey50") +
labs(x = "margin of the unit (premium less expected loss)", y = NULL, fill = NULL,
title = "Table 13.3: the same total margin, shared by nine recipes") +
theme(legend.position = "top")The same premium of 115.2 gives Cat a margin from 3.04 to 15.68, and only the asset allocation causes the difference. The recipes that look at the tail (scaled EPD, coTVaR) leave Non-Cat almost no margin, because Cat causes the 99.9% outcomes. The expected loss recipe ignores risk. Each recipe charges every unit the same 10% return; the natural allocation does not.
3. The natural allocation of the case study (Tables 15.36 and 15.39)
Chapter 15 prices the same book with the five distortions, each calibrated to the same total premium, and uses the lifted natural allocation. Table 15.36 prints the premiums and capital by unit, and Table 15.39 the assets:
BOOK_1536 <- list( # lifted: Cat premium, Cat capital, Cat assets, Non-Cat assets (Tables 15.36 and 15.39)
ccoc = c(47.04, 270.8, 317.8, -50.62),
ph = c(32.89, 103.2, 136.1, 131.1),
wang = c(31.26, 92.20, 123.5, 143.7),
dual = c(29.68, 89.01, 118.7, 148.5),
tvar = c(28.69, 88.87, 117.6, 149.6)
)
rows <- lapply(FAMILIES, function(family) {
u <- natural_price(book, dists[[family]], p = 0.999, allocation = "lifted")
got <- c(u$premium[1], u$capital[1], u$assets[1], u$assets[2])
data.frame(distortion = family, p = got[1], p_book = BOOK_1536[[family]][1],
q = got[2], q_book = BOOK_1536[[family]][2],
a = got[3], a_book = BOOK_1536[[family]][3],
n = got[4], n_book = BOOK_1536[[family]][4])
})
lifted <- do.call(rbind, rows)
gt(lifted, rowname_col = "distortion") |>
tab_header("Tables 15.36 and 15.39: the lifted natural allocation",
"Cat premium, Cat capital, Cat assets and Non-Cat assets, prospicio and the book") |>
tab_spanner("Cat premium", columns = c(p, p_book)) |>
tab_spanner("Cat capital", columns = c(q, q_book)) |>
tab_spanner("Cat assets", columns = c(a, a_book)) |>
tab_spanner("Non-Cat assets", columns = c(n, n_book)) |>
cols_label(p = "prospicio", p_book = "book", q = "prospicio", q_book = "book",
a = "prospicio", a_book = "book", n = "prospicio", n_book = "book") |>
fmt_number(columns = c(p, q, a, n), decimals = 2) |>
fmt_number(columns = c(p_book, q_book, a_book, n_book), decimals = 2, drop_trailing_zeros = TRUE)| Tables 15.36 and 15.39: the lifted natural allocation | ||||||||
| Cat premium, Cat capital, Cat assets and Non-Cat assets, prospicio and the book | ||||||||
|
Cat premium
|
Cat capital
|
Cat assets
|
Non-Cat assets
|
|||||
|---|---|---|---|---|---|---|---|---|
| prospicio | book | prospicio | book | prospicio | book | prospicio | book | |
| ccoc | 39.72 | 47.04 | 197.63 | 270.8 | 237.35 | 317.8 | 29.85 | −50.62 |
| ph | 32.89 | 32.89 | 103.25 | 103.2 | 136.14 | 136.1 | 131.06 | 131.1 |
| wang | 31.26 | 31.26 | 92.18 | 92.2 | 123.44 | 123.5 | 143.76 | 143.7 |
| dual | 29.68 | 29.68 | 89.01 | 89.01 | 118.69 | 118.7 | 148.52 | 148.5 |
| tvar | 28.69 | 28.69 | 88.87 | 88.87 | 117.56 | 117.6 | 149.64 | 149.6 |
Bodoff’s percentile layer of capital (PLC) allocates assets too:
plc <- bodoff_allocation(book, p = 0.999)
cat(sprintf("PLC assets Cat %.2f (113.2), Non-Cat %.2f (154.0)\n", plc[1], plc[2]))## PLC assets Cat 113.17 (113.2), Non-Cat 154.03 (154.0)
assets_by_unit <- rbind(
data.frame(method = c(lifted$distortion, "PLC"), unit = "Cat", assets = c(lifted$a, plc[1])),
data.frame(method = c(lifted$distortion, "PLC"), unit = "Non-Cat", assets = c(lifted$n, plc[2]))
)
assets_by_unit$method <- factor(assets_by_unit$method, levels = c(lifted$distortion, "PLC"))
ggplot(assets_by_unit, aes(method, assets, fill = unit)) +
geom_col(position = position_dodge(width = 0.8), width = 0.7) +
geom_hline(yintercept = 0, colour = "grey50") +
labs(x = "distortion, and Bodoff's percentile layer of capital (PLC)",
y = "assets allocated to the unit", fill = NULL,
title = "Table 15.39: Cat assets fall from CCoC to PLC") +
theme(legend.position = "top")For PH, Wang, the dual power and TVaR, prospicio agrees with the book
within 0.06, and so do Bodoff’s PLC assets. The 0.02 gap in the Wang
capital (92.18 against 92.20) is small next to the spread between
distortions, and its cause is unknown. The PH row agrees with the book
and not with aggregate 0.30.1 (Cat capital
103.52; case studies guide, section 7).
The CCoC row does not agree. aggregate
0.30.1 returns 40.51 for the Cat premium, against 39.72 from prospicio
and 47.04 in the book. The row of the book cannot be a natural
allocation of the CCoC distortion. Under the CCoC each outcome gets a
weight of at least 1 / 1.1 of its probability (the worst
outcome gets the remainder). So each unit pays at least
1 / 1.1 of its expected loss within the assets:
floor <- loss[2] / 1.1
noncat_ccoc <- natural_price(book, dists$ccoc, p = 0.999, allocation = "lifted")$premium[2]
cat(sprintf("lowest possible Non-Cat premium under the CCoC: %.2f\n", floor))## lowest possible Non-Cat premium under the CCoC: 72.72
## prospicio 75.43; book 68.11
The Non-Cat premium of the book (115.15 minus 47.04, a loss ratio of 117%) is below the floor of 72.72. So the CCoC row of Table 15.36 came from a lifted calculation that does not keep all weights non-negative, most probably in how it shared the mass at the worst outcome.
The lifted capital of the CCoC is the quantity that CAS
Monograph 15 reproduced found to change between versions of
aggregate. The book is a third version. As in that guide,
use the premiums of the linear allocation for the CCoC (Cat 35.95 and
Non-Cat 79.20, which aggregate 0.30.1 matches).
The main result stays: the Cat premium falls from the CCoC to TVaR, as the distortion moves its weight from the worst outcome to the upper half of the distribution. PLC weights layers by objective probability, so it is the least sensitive to the tail of all methods (section 15.4.4).
How much can the choice of distortion move the Cat premium?
premium_bounds() gives the lowest and highest premium of
each unit under the linear allocation, over every
distortion that prices the capped total at the same premium (section 7
of the companion guide). All five distortions here have the total
115.15, so one range applies to all. The linear premium of each lies in
it:
total <- tail(natural_price(book, dists$ph, p = 0.999)$premium, 1)
b <- premium_bounds(book, total, assets = a)
linear <- t(sapply(FAMILIES, function(family)
natural_price(book, dists[[family]], p = 0.999, allocation = "linear")$premium[1:2]))
bounds_table <- data.frame(
distortion = c("lowest possible", FAMILIES, "highest possible"),
cat = c(b$lower[b$unit == "Cat"], linear[, 1], b$upper[b$unit == "Cat"]),
noncat = c(b$lower[b$unit == "NonCat"], linear[, 2], b$upper[b$unit == "NonCat"])
)
gt(bounds_table, rowname_col = "distortion") |>
tab_header("Linear premiums and their bounds",
"By unit; the bounds hold for every distortion with total premium 115.15") |>
cols_label(cat = "Cat", noncat = "Non-Cat") |>
fmt_number(columns = c(cat, noncat), decimals = 2)| Linear premiums and their bounds | ||
| By unit; the bounds hold for every distortion with total premium 115.15 | ||
| Cat | Non-Cat | |
|---|---|---|
| lowest possible | 28.69 | 79.20 |
| ccoc | 35.95 | 79.20 |
| ph | 32.79 | 82.36 |
| wang | 31.25 | 83.90 |
| dual | 29.68 | 85.48 |
| tvar | 28.69 | 86.46 |
| highest possible | 35.95 | 86.46 |
The CCoC and TVaR sit at the two ends, as in the small book of the companion guide. The CCoC puts its spare weight on the worst outcome, which loads Cat, the unit that causes it. TVaR spreads the weight over the upper tail.
4. Is a reinsurance cover worth buying? (chapter 19)
An insurer prices with a spectral risk measure. Should it buy a cover
with cash flows C at a premium P? The direct
test (the book’s “A/B” method) prices the book gross and net and
compares the saving with P. Two shortcuts price
C as a unit of the gross book or of the net book. They are
first-order approximations, so their results differ slightly from the
direct test.
Example 302 puts an aggregate cover of 2.5 excess of 7 on
X1 of the Simple Discrete Example, where X1
takes 0, 8 or 10 and X2 takes 0, 1 or 90. It prices with
the proportional hazard g(s) = s^0.5. The gross allocation
uses a three-unit portfolio: X1 net of the cover, the cover
and X2, which add up to the gross loss:
ph <- distortion("proportional_hazard", 0.5)
OUT <- expand.grid(x2 = c(0, 1, 90), x1 = c(0, 8, 10))
OUT$ceded <- pmin(pmax(OUT$x1 - 7, 0), 2.5)
PROBS <- as.vector(outer(c(0.5, 0.25, 0.25), c(0.5, 0.25, 0.25)))
gross <- capital_portfolio(cbind(`X1 net` = OUT$x1 - OUT$ceded, ceded = OUT$ceded, X2 = OUT$x2), probs = PROBS)
g <- natural_price(gross, ph)
net_price <- function(t) {
natural_price(capital_portfolio(cbind(net = OUT$x1 + OUT$x2 - t * OUT$ceded), probs = PROBS), ph)$premium[2]
}
net <- net_price(1)
example_302 <- data.frame(
measure = c("gross premium", "ceded, allocated gross", "net premium", "A/B saving"),
prospicio = c(g$premium[4], g$premium[2], net, g$premium[4] - net),
book = c(51.1560, 1.2613, 49.8986, 1.2574)
)
gt(example_302, rowname_col = "measure") |>
tab_header("Example 302: the cover 2.5 xs 7 under the proportional hazard") |>
fmt_number(columns = c(prospicio, book), decimals = 4)| Example 302: the cover 2.5 xs 7 under the proportional hazard | ||
| prospicio | book | |
|---|---|---|
| gross premium | 51.1560 | 51.1560 |
| ceded, allocated gross | 1.2613 | 1.2613 |
| net premium | 49.8986 | 49.8986 |
| A/B saving | 1.2574 | 1.2574 |
The net allocation prices C with the weights of the
net book, which depend only on the order of the net
outcomes. The cover changes that order: 10 + 0 (net 7.5) now ranks below
8 + 1 (net 8). capital_portfolio() sorts outcomes by its
own total. So the code adds the cover as a unit scaled down by a very
small factor, which keeps the net order and the weights, and scales the
allocation of the cover back up:
tiny <- 1e-6
net_view <- capital_portfolio(cbind(`X1 net` = OUT$x1 - OUT$ceded, X2 = OUT$x2, ceded = tiny * OUT$ceded), probs = PROBS)
ceded_net <- natural_price(net_view, ph)$premium[3] / tiny
cat(sprintf("ceded, allocated net %.4f (book 1.2497)\n", ceded_net))## ceded, allocated net 1.2497 (book 1.2497)
The three reservation prices (the highest cover premium at which a
test still buys) are 1.2613 for the gross allocation, 1.2574 for the A/B
test and 1.2497 for the net allocation. Below about 1.25 the cover is
worth buying on all tests, and above about 1.26 on none. Between these
prices the answer depends on the method. The book then lets the insurer
buy a share t of the cover for t P. At an
intermediate premium the best share is neither 0 nor 1 but 2/3, where
the two net outcomes that change places tie:
shares <- (0:30) / 30
rows <- lapply(c(1.2497, 1.2574, 1.2613), function(premium) {
cost <- sapply(shares, function(t) net_price(t) + t * premium)
best <- which.min(cost)
data.frame(premium = format(premium), share = shares[best], cost = cost[best])
})
gt(do.call(rbind, rows), rowname_col = "premium") |>
tab_header("Example 302: the cheapest share of the cover",
"By cover premium; cost = net premium + share x premium") |>
cols_label(share = "cheapest share", cost = "total cost") |>
fmt_number(columns = share, decimals = 3) |>
fmt_number(columns = cost, decimals = 4)| Example 302: the cheapest share of the cover | ||
| By cover premium; cost = net premium + share x premium | ||
| cheapest share | total cost | |
|---|---|---|
| 1.2497 | 1.000 | 51.1483 |
| 1.2574 | 0.667 | 51.1534 |
| 1.2613 | 0.000 | 51.1560 |
shares <- (0:30) / 30
costs <- sapply(shares, net_price)
curves <- do.call(rbind, lapply(c(1.2497, 1.2574, 1.2613), function(premium) {
data.frame(share = shares, extra = costs + shares * premium - costs[1],
premium = paste("cover premium", format(premium)))
}))
best <- do.call(rbind, lapply(split(curves, curves$premium), function(df) df[which.min(df$extra), ]))
ggplot(curves, aes(share, extra, colour = premium)) +
geom_hline(yintercept = 0, colour = "grey50") +
geom_line() +
geom_point(data = best, size = 2.5) +
labs(x = "share t of the cover bought", y = "total cost, less the cost with no cover",
colour = NULL, title = "Example 302: the cheapest share depends on the cover premium") +
theme(legend.position = "top")This is Figure 19.1 of the book. With many covers the direct test needs every combination; the book suggests a search that uses the allocations as gradients.