Skip to contents

Rendered from docs/guides/pir-portfolio-pricing.qmd. The code runs each time the site is built, so the output below is current.

Part II of Mildenhall and Major’s Pricing Insurance Risk: Theory and Practice (Wiley, 2022) is chapters 8 to 11. It prices a portfolio in two ways:

  • Classical (chapters 8 and 9): premium calculation principles on each unit or on the total, the portfolio constant cost of capital (CCoC), ruin theory and option pricing.
  • Modern (chapters 10 and 11): the premium is a distortion of the loss capped at the assets, a spectral risk measure (SRM). The book calibrates five representative distortions to one target and compares them.

Exhibit numbers are the book’s. The text belongs to the authors, and this guide explains it in new words. Related guides:

This is the R twin of the Python guide pir-portfolio-pricing.md, with the same sections, examples and numbers. The text under each R chunk is its output; R/prospicio/tests/test-guides.R requires each chunk to print exactly that text. To render the page, install the R package (remotes::install_github, see R/prospicio/bootstrap.R) and run quarto render docs/guides/pir-portfolio-pricing.qmd.

library(prospicio)

1. Two books to price

The practice chapters use the book’s case studies. Two of them run fast enough for a guide:

  • Tame has two gamma units with mean 50 and CVs 0.10 and 0.15, at a 99.99% VaR capital standard. In the net view, an aggregate cover of 12.91 excess of 56.17 applies to unit B.
  • Cat/Non-Cat has a gamma Non-Cat unit (mean 80, CV 0.15) and a lognormal Cat unit (mean 20, CV 1), at 99.9%. In the net view, 79.64 excess of 41.11 applies to Cat (Table 7.3).

The code puts each unit on the grid of aggregate, with a step of 1/64 and 2^16 points. A net unit is the gross unit minus the recovery of the cover, outcome by outcome:

started <- Sys.time()
STEP <- 1 / 64
POINTS <- 2^16

# A severity on aggregate's grid: rounded, the mass above the top spread by renormalizing.
discretize_renormalized <- function(severity) {
  probs <- discretize(severity, STEP, 2 * POINTS, method = "rounding")@probs[seq_len(POINTS)]
  grid_distribution(STEP, probs / sum(probs))
}

# The grid's loss less an aggregate cover of limit excess of attachment.
net_of <- function(grid, limit, attachment) {
  map_grid(grid, function(x) x - pmin(pmax(x - attachment, 0), limit))$grid
}

# The total of a portfolio as a grid.
total_grid <- function(book) {
  idx <- round(book@totals / STEP) + 1
  probs <- tapply(book@probs, factor(idx, levels = seq_len(max(idx))), sum)
  grid_distribution(STEP, ifelse(is.na(probs), 0, probs))
}

# Python's repr of a float, for the book's printed values: 102.0 rather than 102.
pyfloat <- function(x) ifelse(x == round(x), sprintf("%.1f", x), as.character(x))
pylist <- function(x) paste0("[", paste(pyfloat(x), collapse = ", "), "]")

a_unit <- discretize_renormalized(gamma_from_mean_cv(50, 0.10))
b_unit <- discretize_renormalized(gamma_from_mean_cv(50, 0.15))
b_net <- net_of(b_unit, 12.91, 56.17)
tame <- capital_portfolio(list(A = a_unit, B = b_unit))
tame_net <- capital_portfolio(list(A = a_unit, B = b_net))

cat_unit <- discretize_renormalized(lognormal_from_mean_cv(20, 1))
non_cat <- discretize_renormalized(gamma_from_mean_cv(80, 0.15))
cat_net <- net_of(cat_unit, 79.64, 41.11)
cnc <- capital_portfolio(list(Cat = cat_unit, NonCat = non_cat))
cnc_net <- capital_portfolio(list(Cat = cat_net, NonCat = non_cat))

cat(sprintf("means: B net %.3f (book 49.08), Cat net %.3f (book 17.79)\n", mean(b_net), mean(cat_net)))
## means: B net 49.084 (book 49.08), Cat net 17.786 (book 17.79)

The covers are quantiles of the gross units: 80% and 99% of B (56.17, 69.08), 90% and 99.5% of Cat (41.11, 120.75). map_grid() puts the net unit exactly on the grid. tower_on_grid() gives the same distribution by FFT, with the FFT round-off (about 1e-19) set to zero. Section 3 shows why that matters.

2. The portfolio CCoC price

Chapter 8’s classical portfolio price is the benchmark of every practice chapter. Assets are the VaR of the total, and the premium charges a constant cost of capital on the capital: P = v E[min(X, a)] + d a, with v = 1 / 1.1 and d = 1 - v at a 10% return. The insurance pentagon gives the margin, capital, loss ratio and leverage.

Table 7.2 gives the result for each book. Leverage is premium to capital (premium_to_capital in natural_price()). The loss is the expected loss within the assets, so it includes default (Cat/Non-Cat gross: 99.95, not 100). All 24 figures agree:

library(gt)

# A table whose rows alternate prospicio and the book: prospicio at fixed decimals, the book as printed.
pair_table <- function(frame, decimals) {
  own_rows <- seq(1, nrow(frame), by = 2)
  book_rows <- seq(2, nrow(frame), by = 2)
  table <- gt(frame, rowname_col = names(frame)[1])
  for (column in names(decimals)) {
    table <- table |>
      fmt_number(columns = all_of(column), rows = own_rows, decimals = decimals[[column]], use_seps = FALSE) |>
      fmt_number(columns = all_of(column), rows = book_rows, decimals = 4, drop_trailing_zeros = TRUE, use_seps = FALSE)
  }
  sub_missing(table, missing_text = "")
}

ccoc <- distortion("ccoc", 0.10)
BOOK_72 <- list( # Table 7.2: loss, margin, premium, capital, assets, leverage
  c(100.00, 3.42, 103.4, 34.23, 137.7, 3.02),
  c(99.08, 2.46, 101.5, 24.64, 126.2, 4.12),
  c(99.95, 15.21, 115.2, 152.1, 267.2, 0.757),
  c(97.73, 8.17, 105.9, 81.68, 187.6, 1.3)
)
BOOKS <- list(
  list(name = "Tame", view = "gross", book = tame, p = 0.9999),
  list(name = "Tame", view = "net", book = tame_net, p = 0.9999),
  list(name = "Cat/Non-Cat", view = "gross", book = cnc, p = 0.999),
  list(name = "Cat/Non-Cat", view = "net", book = cnc_net, p = 0.999)
)
BOOK_NAMES <- sapply(BOOKS, function(b) paste(b$name, b$view))
interleave <- function(mine, book) as.vector(rbind(mine, paste0(mine, ", book")))
total_row <- function(prices) prices[prices$unit == "total", ]
COLUMNS_72 <- c("loss", "margin", "premium", "capital", "assets", "P/Q")
rows <- list()
for (k in seq_along(BOOKS)) {
  b <- BOOKS[[k]]
  t <- total_row(natural_price(b$book, ccoc, p = b$p))
  rows[[2 * k - 1]] <- c(t$loss, t$margin, t$premium, t$capital, t$assets, t$premium_to_capital)
  rows[[2 * k]] <- BOOK_72[[k]]
}
table_72 <- data.frame(book = interleave(BOOK_NAMES), do.call(rbind, rows), check.names = FALSE)
names(table_72)[-1] <- COLUMNS_72
pair_table(table_72, c(setNames(rep(2, 5), COLUMNS_72[1:5]), `P/Q` = 3)) |>
  tab_header("Table 7.2: the portfolio CCoC price", "Currency units; P/Q is premium over capital")
Table 7.2: the portfolio CCoC price
Currency units; P/Q is premium over capital
loss margin premium capital assets P/Q
Tame gross 100.00 3.42 103.42 34.23 137.66 3.021
Tame gross, book 100 3.42 103.4 34.23 137.7 3.02
Tame net 99.08 2.46 101.55 24.64 126.19 4.121
Tame net, book 99.08 2.46 101.5 24.64 126.2 4.12
Cat/Non-Cat gross 99.95 15.21 115.15 152.05 267.20 0.757
Cat/Non-Cat gross, book 99.95 15.21 115.2 152.1 267.2 0.757
Cat/Non-Cat net 97.73 8.17 105.90 81.68 187.58 1.297
Cat/Non-Cat net, book 97.73 8.17 105.9 81.68 187.6 1.3

Stand-alone, each unit holds its own 99.99% or 99.9% VaR, so the units together need more capital than the book (Tables 9.12, 9.13 and 9.11). B and Cat are net of their cover in the net rows. P is premium and Q is capital:

BOOK_SA <- list( # Tables 9.12, 9.13: stand-alone premium and capital by unit; Table 9.11's sums
  list(c(51.89, 52.98), c(18.88, 29.82), 104.9, 48.69),
  list(c(51.89, 50.98), c(18.88, 18.91), 102.9, 37.79),
  list(c(34.98, 83.84), c(150.3, 38.41), 118.8, 188.7),
  list(c(25.72, 83.84), c(79.92, 38.41), 109.6, 118.3)
)
rows <- list()
for (k in seq_along(BOOKS)) {
  b <- BOOKS[[k]]
  sa <- price_stand_alone(b$book, ccoc, b$p)
  units <- sa[1:2, ]
  s <- sa[sa$unit == "sum", ]
  t <- sa[sa$unit == "total", ]
  bk <- BOOK_SA[[k]]
  rows[[2 * k - 1]] <- c(units$premium[1], units$capital[1], units$premium[2], units$capital[2],
                         s$premium, t$premium, t$premium / s$premium - 1,
                         s$capital, t$capital, t$capital / s$capital - 1)
  rows[[2 * k]] <- c(bk[[1]][1], bk[[2]][1], bk[[1]][2], bk[[2]][2], bk[[3]], NA, NA, bk[[4]], NA, NA)
}
table_sa <- data.frame(book = interleave(BOOK_NAMES), do.call(rbind, rows))
names(table_sa)[-1] <- c("p1", "q1", "p2", "q2", "sum_p", "total_p", "saved_p", "sum_q", "total_q", "saved_q")
pair_table(table_sa, setNames(rep(2, 8), c("p1", "q1", "p2", "q2", "sum_p", "total_p", "sum_q", "total_q"))) |>
  fmt_percent(columns = c("saved_p", "saved_q"), rows = seq(1, nrow(table_sa), by = 2), decimals = 1) |>
  tab_header("Tables 9.12, 9.13 and 9.11: stand-alone against pooled",
             "Units A, B (Tame) and Cat, Non-Cat (Cat/Non-Cat); currency units") |>
  tab_spanner("unit 1", columns = c("p1", "q1")) |>
  tab_spanner("unit 2", columns = c("p2", "q2")) |>
  tab_spanner("premium", columns = c("sum_p", "total_p", "saved_p")) |>
  tab_spanner("capital", columns = c("sum_q", "total_q", "saved_q")) |>
  cols_label(p1 = "P", q1 = "Q", p2 = "P", q2 = "Q", sum_p = "sum of units", total_p = "total",
             saved_p = "change", sum_q = "sum of units", total_q = "total", saved_q = "change")
Tables 9.12, 9.13 and 9.11: stand-alone against pooled
Units A, B (Tame) and Cat, Non-Cat (Cat/Non-Cat); currency units
unit 1
unit 2
premium
capital
P Q P Q sum of units total change sum of units total change
Tame gross 51.89 18.88 52.98 29.82 104.87 103.42 −1.4% 48.69 34.23 −29.7%
Tame gross, book 51.89 18.88 52.98 29.82 104.9

48.69

Tame net 51.89 18.88 50.98 18.92 102.86 101.55 −1.3% 37.79 24.64 −34.8%
Tame net, book 51.89 18.88 50.98 18.91 102.9

37.79

Cat/Non-Cat gross 34.98 150.31 83.84 38.41 118.81 115.15 −3.1% 188.72 152.05 −19.4%
Cat/Non-Cat gross, book 34.98 150.3 83.84 38.41 118.8

188.7

Cat/Non-Cat net 25.72 79.92 83.84 38.41 109.56 105.90 −3.3% 118.33 81.68 −31.0%
Cat/Non-Cat net, book 25.72 79.92 83.84 38.41 109.6

118.3

Premium falls less than capital, because most of it is expected loss and pooling does not change that. The thin tails of Tame give the most diversification.

3. Classical premium principles

Section 9.1 applies ten of the premium calculation principles of section 8.4 (PCPs). Each is calibrated so that the gross total costs the CCoC premium above, then applied stand-alone to each unit, to the net units and to the net total. prospicio has them as classical_premium(x, principle, loading); calibrate_classical() finds a loading. The book’s Fischer principle uses the power 2, the prospicio default.

Table 9.2 lists the Tame premiums, sorted by the net total, with the book’s loading. The last column is the largest gap to the book’s premiums in the row:

PRINCIPLES <- c("expected_value", "variance", "esscher", "exponential", "semi_variance",
                "var", "dutch", "standard_deviation", "fischer")
BOOK_92 <- list( # Table 9.2, Tame: loading; A, B net, B gross, total net, total gross
  expected_value = c(0.034, 51.712, 50.765, 51.712, 102.476, 103.423),
  variance = c(0.042, 51.053, 50.620, 52.370, 101.673, 103.423),
  esscher = c(0.041, 51.034, 50.468, 52.389, 101.503, 103.423),
  exponential = c(0.080, 51.028, 50.420, 52.395, 101.447, 103.423),
  semi_variance = c(0.080, 51.051, 50.330, 52.425, 101.411, 103.423),
  var = c(0.659, 51.906, 52.750, 52.750, 102.672, 103.422),
  dutch = c(0.953, 51.899, 51.498, 52.846, 102.096, 103.423),
  standard_deviation = c(0.380, 51.899, 51.377, 52.848, 102.061, 103.423),
  fischer = c(0.523, 51.897, 51.149, 52.881, 101.907, 103.423)
)

# Each principle's loading and premiums on the grids, with the book's loading and the largest gap.
classical_frame <- function(gross_total, grids, labels, target, book_values) {
  rows <- lapply(names(book_values), function(principle) {
    book <- book_values[[principle]]
    t <- calibrate_classical(gross_total, principle, target)
    got <- sapply(grids, function(g) classical_premium(g, principle, t))
    c(t, book[1], got, max(abs(got - book[-1])))
  })
  frame <- data.frame(principle = gsub("_", " ", names(book_values)), do.call(rbind, rows), check.names = FALSE)
  names(frame)[-1] <- c("loading", "book loading", labels, "gap")
  frame[order(frame$net), ]
}

classical_gt <- function(frame, title, subtitle, spanned) {
  table <- gt(frame, rowname_col = "principle") |>
    tab_header(title, subtitle) |>
    tab_spanner("calibrated loading", columns = c("loading", "book loading")) |>
    fmt_number(columns = everything(), decimals = 3) |>
    cols_label(loading = "prospicio", `book loading` = "book")
  for (label in names(spanned)) table <- tab_spanner(table, label, columns = spanned[[label]])
  table
}

tame_target <- total_row(natural_price(tame, ccoc, p = 0.9999))$premium
tame_total <- total_grid(tame)
tame_net_total <- total_grid(tame_net)
tame_92 <- classical_frame(tame_total, list(a_unit, b_net, b_unit, tame_net_total, tame_total),
                           c("A", "B net", "B", "net", "total"), tame_target, BOOK_92)
classical_gt(tame_92, "Table 9.2: Tame premiums by principle, each calibrated to the CCoC total",
             "Currency units; the loading is the parameter of the principle",
             list(units = c("A", "B net", "B"), totals = c("net", "total")))
Table 9.2: Tame premiums by principle, each calibrated to the CCoC total
Currency units; the loading is the parameter of the principle
calibrated loading
units
totals
gap
prospicio book A B net B net total
semi variance 0.080 0.080 51.051 50.330 52.425 101.411 103.423 0.000
exponential 0.080 0.080 51.028 50.419 52.395 101.447 103.423 0.001
esscher 0.041 0.041 51.034 50.468 52.389 101.502 103.423 0.001
variance 0.042 0.042 51.053 50.619 52.370 101.672 103.423 0.001
fischer 0.523 0.523 51.897 51.149 52.881 101.906 103.423 0.001
standard deviation 0.380 0.380 51.899 51.376 52.848 102.060 103.423 0.001
dutch 0.953 0.953 51.899 51.498 52.846 102.096 103.423 0.000
expected value 0.034 0.034 51.712 50.764 51.712 102.476 103.423 0.001
var 0.659 0.659 51.906 52.750 52.750 102.672 103.422 0.000

Loadings and premiums agree to the third decimal (0.001 is rounding).

Table 9.3 subtracts the pooled premium from the sum of the stand-alone premiums (SoP). The book prints the gross SoP for every principle but expected value:

BOOK_93 <- c(variance = 103.423, esscher = 103.423, exponential = 103.423, semi_variance = 103.477,
             var = 104.656, dutch = 104.745, standard_deviation = 104.747, fischer = 104.778)
rows <- lapply(PRINCIPLES, function(principle) {
  t <- calibrate_classical(tame_total, principle, tame_target)
  sop <- classical_premium(a_unit, principle, t) + classical_premium(b_unit, principle, t)
  sop_net <- classical_premium(a_unit, principle, t) + classical_premium(b_net, principle, t)
  net <- classical_premium(tame_net_total, principle, t)
  c(sop, sop - tame_target, unname(BOOK_93[principle]), sop_net, sop_net - net)
})
table_93 <- data.frame(principle = gsub("_", " ", PRINCIPLES), do.call(rbind, rows))
names(table_93)[-1] <- c("sop", "delta", "book", "sop_net", "delta_net")
gt(table_93, rowname_col = "principle") |>
  tab_header("Table 9.3: stand-alone sum less the pooled premium", "Tame; currency units") |>
  tab_spanner("gross", columns = c("sop", "delta", "book")) |>
  tab_spanner("net", columns = c("sop_net", "delta_net")) |>
  fmt_number(columns = everything(), decimals = 3) |>
  sub_missing(missing_text = "") |>
  cols_label(sop = "SoP", delta = "delta", book = "book SoP", sop_net = "SoP", delta_net = "delta")
Table 9.3: stand-alone sum less the pooled premium
Tame; currency units
gross
net
SoP delta book SoP SoP delta
expected value 103.423 0.000
102.476 0.000
variance 103.423 0.000 103.423 101.672 0.000
esscher 103.423 0.000 103.423 101.502 0.000
exponential 103.423 0.000 103.423 101.447 0.000
semi variance 103.477 0.054 103.477 101.381 −0.030
var 104.656 1.233 104.656 104.656 1.984
dutch 104.745 1.322 104.745 103.397 1.301
standard deviation 104.747 1.324 104.747 103.275 1.214
fischer 104.778 1.355 104.778 103.046 1.140

The deltas show that the formula of a principle, not the data, sets its view of diversification:

  • Expected value, variance, Esscher and exponential are additive for independent units, so pooling earns nothing.
  • VaR and the deviation principles (Dutch, standard deviation, Fischer) are subadditive. They charge the pool about 1.3 less than the parts.
  • The semivariance is neither. Its delta changes sign between gross and net (0.054 and -0.029 in the book).

Two principles are sensitive to how the net B grid is made. The exponential and Esscher premiums weight an outcome x by exp(t x). On a grid to 1,024, exp(0.08 x) is about 1e35 at the top, so an FFT round-off of 1e-19 there would give a premium of hundreds. tower_on_grid() sets probabilities below machine epsilon to zero, as aggregate’s remove_fuzz does, so its net grid prices like the exact grid:

cover <- reinsurance_tower(list(aggregate_stop_loss("B", 12.91, 56.17)))
b_net_fft <- tower_on_grid(cover, fixed_count(1), b_unit, POINTS)$net
t_exp <- calibrate_classical(tame_total, "exponential", tame_target)
fft_premium <- classical_premium(b_net_fft, "exponential", t_exp)
noise <- max(b_net_fft@probs[-seq_len(150 * 64)])
cat(sprintf("exponential premium of net B: by map %.3f, from the FFT %.3f (book 50.420)\n",
            classical_premium(b_net, "exponential", t_exp), fft_premium))
## exponential premium of net B: by map 50.419, from the FFT 50.419 (book 50.420)
cat(sprintf("largest probability above 150: FFT %s, map exactly zero\n",
            if (noise == 0) "exactly zero" else noise))
## largest probability above 150: FFT exactly zero, map exactly zero

For a grid from another source (for example, your own FFT), call remove_fuzz() before you price with these two principles.

On Cat/Non-Cat, the principles differ much more (Tables 9.5 and 9.6):

BOOK_95 <- list( # Table 9.5, Cat/Non-Cat: loading; Cat net, Cat, Non-Cat, total net, total gross
  expected_value = c(0.152, 20.480, 23.030, 92.121, 112.601, 115.151),
  var = c(0.818, 30.109, 30.109, 90.734, 113.391, 115.141),
  variance = c(0.028, 22.573, 31.141, 84.013, 106.585, 115.151),
  dutch = c(1.859, 27.170, 32.000, 88.882, 110.638, 115.151),
  semi_variance = c(0.040, 22.513, 32.785, 83.092, 105.194, 115.151),
  standard_deviation = c(0.650, 26.302, 32.992, 87.797, 109.332, 115.151),
  fischer = c(0.776, 26.249, 33.918, 86.844, 108.380, 115.151)
)
cnc_target <- total_row(natural_price(cnc, ccoc, p = 0.999))$premium
cnc_total <- total_grid(cnc)
cnc_net_total <- total_grid(cnc_net)
cnc_95 <- classical_frame(cnc_total, list(cat_net, cat_unit, non_cat, cnc_net_total, cnc_total),
                          c("Cat net", "Cat", "Non-Cat", "net", "total"), cnc_target, BOOK_95)
classical_gt(cnc_95, "Tables 9.5 and 9.6: Cat/Non-Cat premiums by principle, each calibrated to the CCoC total",
             "Currency units; the loading is the parameter of the principle",
             list(units = c("Cat net", "Cat", "Non-Cat"), totals = c("net", "total")))
Tables 9.5 and 9.6: Cat/Non-Cat premiums by principle, each calibrated to the CCoC total
Currency units; the loading is the parameter of the principle
calibrated loading
units
totals
gap
prospicio book Cat net Cat Non-Cat net total
semi variance 0.040 0.040 22.512 32.782 83.091 105.193 115.151 0.003
variance 0.028 0.028 22.572 31.139 84.012 106.584 115.151 0.002
fischer 0.776 0.776 26.248 33.916 86.843 108.380 115.151 0.002
standard deviation 0.650 0.650 26.301 32.991 87.797 109.331 115.151 0.001
dutch 1.859 1.859 27.170 32.000 88.882 110.638 115.151 0.000
expected value 0.152 0.152 20.480 23.030 92.121 112.601 115.151 0.000
var 0.818 0.818 30.109 30.109 90.734 113.391 115.141 0.000

Seven principles agree to within 0.003, the difference that two truncations of a lognormal tail give. Esscher and exponential do not, and should not:

BOOK_EXP <- list(esscher = c(0.011, 23.575, 35.944, 81.561, 105.054),
                 exponential = c(0.014, 24.760, 39.697, 81.059, 105.619))
rows <- list()
for (principle in names(BOOK_EXP)) {
  t <- calibrate_classical(cnc_total, principle, cnc_target)
  got <- sapply(list(cat_net, cat_unit, non_cat, cnc_net_total), function(g) classical_premium(g, principle, t))
  rows[[length(rows) + 1]] <- c(t, got)
  rows[[length(rows) + 1]] <- BOOK_EXP[[principle]]
}
table_exp <- data.frame(principle = interleave(names(BOOK_EXP)), do.call(rbind, rows), check.names = FALSE)
names(table_exp)[-1] <- c("loading", "Cat net", "Cat", "Non-Cat", "net")
pair_table(table_exp, c(loading = 4, `Cat net` = 3, Cat = 3, `Non-Cat` = 3, net = 3)) |>
  tab_header("Esscher and exponential premiums on Cat/Non-Cat", "Currency units; the book's values are as printed")
Esscher and exponential premiums on Cat/Non-Cat
Currency units; the book's values are as printed
loading Cat net Cat Non-Cat net
esscher 0.0103 22.760 33.639 81.512 104.272
esscher, book 0.011 23.575 35.944 81.561 105.054
exponential 0.0138 22.820 34.139 81.012 103.832
exponential, book 0.014 24.76 39.697 81.059 105.619
lower <- cat_unit@probs[seq_len(POINTS / 2)]
top_half <- grid_distribution(STEP, lower / sum(lower))
cat(sprintf("exponential premium of Cat at loading 0.014: grid to 1,024 %.3f, grid to 512 %.3f\n",
            classical_premium(cat_unit, "exponential", 0.014), classical_premium(top_half, "exponential", 0.014)))
## exponential premium of Cat at loading 0.014: grid to 1,024 35.497, grid to 512 25.189

A lognormal has no exponential moment: E[exp(t X)] is infinite for every t > 0, so both premiums are artifacts of where the grid stops (the book’s numbers are what its grid gave). The book does not apply them to the Hurricane/SCS case for this reason. Do not use them for a loss without a light tail.

4. Ruin theory and the natural scale of a market

Section 9.3 uses the Pollaczeck-Khinchine formula for the probability of eventual ruin of a compound Poisson surplus process (eventual_ruin() and its capital_interpolated). The example is a liability line with lognormal claims of mean 50,000 and CV 10, limited at 1M, 5M or 10M.

With a margin r on expected loss, the formula gives the starting surplus u at which eventual ruin has probability p. The annual margin, n r E[X] for n claims a year, must pay a cost of capital delta on u, so a market needs at least n = delta u / (r E[X]) claims a year (Eq. (9.2)). Table 9.15 gives n for delta = 0.1:

claim <- lognormal_from_mean_cv(50000, 10)
BOOK_915 <- list( # Table 9.15: limit -> p -> n at r = 0.05, 0.1, 0.25
  list(limit = 1e6, book = list(`0.01` = c(10172, 2655, 476.1), `0.1` = c(5021, 1294, 224.5))),
  list(limit = 1e7, book = list(`0.01` = c(33610, 9087, 1765), `0.1` = c(16384, 4324, 793.6)))
)
RUIN_P <- c(0.01, 0.1)
rows <- list()
cases <- character()
for (row in BOOK_915) {
  limit <- row$limit
  # 10,000 steps up to the limit; the claim's mass above the limit lands on it
  capped <- map_grid(discretize(claim, limit / 10000, 10001, method = "rounding"), function(x) pmin(x, limit))$grid
  counts <- sapply(c(0.05, 0.1, 0.25), function(r) {  # one row per p, one column per r
    u <- eventual_ruin(capped, rho = r, p = RUIN_P, points = 2^18)$capital_interpolated
    0.1 * u / (r * mean(capped))
  })
  for (i in seq_along(RUIN_P)) {
    book <- row$book[[i]]
    cases <- c(cases, sprintf("%s, p %s", formatC(limit, format = "d", big.mark = ","), RUIN_P[i]))
    rows[[length(rows) + 1]] <- c(counts[i, ], book, book / counts[i, ])
  }
}
table_915 <- data.frame(case = cases, do.call(rbind, rows))
names(table_915)[-1] <- c("n1", "n2", "n3", "b1", "b2", "b3", "x1", "x2", "x3")
gt(table_915, rowname_col = "case") |>
  tab_header("Table 9.15: claims a year a market needs", "By limit and ruin probability p, at margins r = 5%, 10%, 25%") |>
  tab_spanner("prospicio", columns = c("n1", "n2", "n3")) |>
  tab_spanner("book", columns = c("b1", "b2", "b3")) |>
  tab_spanner("book / prospicio", columns = c("x1", "x2", "x3")) |>
  fmt_number(columns = c("n1", "n2", "n3"), decimals = 1, use_seps = FALSE) |>
  fmt_number(columns = c("b1", "b2", "b3"), decimals = 1, drop_trailing_zeros = TRUE, use_seps = FALSE) |>
  fmt_number(columns = c("x1", "x2", "x3"), decimals = 2) |>
  cols_label(n1 = "5%", n2 = "10%", n3 = "25%", b1 = "5%", b2 = "10%", b3 = "25%", x1 = "5%", x2 = "10%", x3 = "25%")
Table 9.15: claims a year a market needs
By limit and ruin probability p, at margins r = 5%, 10%, 25%
prospicio
book
book / prospicio
5% 10% 25% 5% 10% 25% 5% 10% 25%
1,000,000, p 0.01 1019.0 266.0 47.7 10172 2655 476.1 9.98 9.98 9.98
1,000,000, p 0.1 503.0 129.7 22.5 5021 1294 224.5 9.98 9.98 9.99
10,000,000, p 0.01 3362.0 909.0 176.5 33610 9087 1765 10.00 10.00 10.00
10,000,000, p 0.1 1639.0 432.5 79.4 16384 4324 793.6 10.00 10.00 10.00

Every prospicio count is one tenth of the book’s. The book’s table is u / (r E[X]), Eq. (9.2) with delta = 1, so it seems to omit the cost of capital of 0.1 that its caption gives. The text example has the same factor: 39,776 claims, about 800,000 policies, for a 1M limit at p = 0.01 and r = 0.025. The factor is constant, so the book’s conclusions about the scale hold. (The grid causes the remaining 0.2%.)

5. The modern view: a price for each layer of assets

Chapter 10 starts from the layer. The risk that losses consume the l-th unit of assets is a Bernoulli with probability s = S(l), priced at g(s), where g is a distortion. Summed over the layers, this is the premium for a loss X with assets a: the integral of g(S(x)) from 0 to a, the SRM of the capped loss X ^ a.

A Bernoulli layer has expected loss s, premium g(s), margin g(s) - s and capital 1 - g(s). Its loss ratio is s / g(s), its return on capital (g(s) - s) / (1 - g(s)), and its premium leverage g(s) / (1 - g(s)). Exercise 142 tabulates these for the proportional hazard distortions s^rho (Table 10.3). The last column is the largest gap to the book:

BOOK_103 <- list( # Table 10.3 at s = 0.01, 0.1, 0.5: loss ratio, risk return, premium leverage
  `0.4` = list(c(0.0631, 0.2512, 0.6598), c(0.1765, 0.4953, 1.0649), c(0.1883, 0.6614, 3.1298)),
  `0.5` = list(c(0.1000, 0.3162, 0.7071), c(0.1000, 0.3162, 0.7071), c(0.1111, 0.4625, 2.4142)),
  `0.7` = list(c(0.2512, 0.5012, 0.8123), c(0.0310, 0.1243, 0.3006), c(0.0415, 0.2493, 1.6013)),
  `0.9` = list(c(0.6310, 0.7943, 0.9330), c(0.0059, 0.0296, 0.0773), c(0.0161, 0.1440, 1.1546))
)
S <- c(0.01, 0.1, 0.5)
rows <- lapply(names(BOOK_103), function(rho) {
  gs <- distortion_g(distortion("proportional_hazard", as.numeric(rho)), S)
  stats <- list(S / gs, (gs - S) / (1 - gs), gs / (1 - gs))
  c(unlist(stats), max(abs(unlist(stats) - unlist(BOOK_103[[rho]]))))
})
names_103 <- paste0(rep(c("lr", "roc", "lev"), each = 3), 1:3)
table_103 <- data.frame(rho = paste("rho", names(BOOK_103)), do.call(rbind, rows))
names(table_103)[-1] <- c(names_103, "gap")
gt(table_103, rowname_col = "rho") |>
  tab_header("Table 10.3: Bernoulli layers under the proportional hazard", "At s = 0.01, 0.1 and 0.5") |>
  tab_spanner("loss ratio", columns = names_103[1:3]) |>
  tab_spanner("return on capital", columns = names_103[4:6]) |>
  tab_spanner("premium leverage", columns = names_103[7:9]) |>
  fmt_number(columns = everything(), decimals = 4) |>
  cols_label(.list = setNames(as.list(paste("s =", rep(S, 3))), names_103))
Table 10.3: Bernoulli layers under the proportional hazard
At s = 0.01, 0.1 and 0.5
loss ratio
return on capital
premium leverage
gap
s = 0.01 s = 0.1 s = 0.5 s = 0.01 s = 0.1 s = 0.5 s = 0.01 s = 0.1 s = 0.5
rho 0.4 0.0631 0.2512 0.6598 0.1765 0.4953 1.0649 0.1883 0.6614 3.1298 0.0000
rho 0.5 0.1000 0.3162 0.7071 0.1000 0.3162 0.7071 0.1111 0.4625 2.4142 0.0000
rho 0.7 0.2512 0.5012 0.8123 0.0310 0.1243 0.3006 0.0415 0.2493 1.6013 0.0000
rho 0.9 0.6310 0.7943 0.9330 0.0059 0.0296 0.0773 0.0161 0.1440 1.1546 0.0000

The main lesson of the chapter: a concave g charges remote layers (small s) a low loss ratio, but they need much capital for each unit of premium, so their return is also low. The return on capital increases with s. Only the CCoC distortion, a straight line from (0, d) to (1, 1), earns the same return on every layer. Hence “constant”.

Return on capital of a layer against its exceedance probability s:

library(ggplot2, exclude = "layer")   # keeps prospicio's layer()
grid_s <- 10^seq(-3, -0.01, length.out = 100)
roc <- do.call(rbind, lapply(
  list("PH, rho 0.5" = distortion("proportional_hazard", 0.5),
       "PH, rho 0.7" = distortion("proportional_hazard", 0.7),
       "CCoC, 10%" = distortion("ccoc", 0.10)),
  function(d) {
    gs <- distortion_g(d, grid_s)
    data.frame(s = grid_s, roc = (gs - grid_s) / (1 - gs))
  }))
roc$distortion <- factor(rep(c("PH, rho 0.5", "PH, rho 0.7", "CCoC, 10%"), each = length(grid_s)),
                         levels = c("PH, rho 0.5", "PH, rho 0.7", "CCoC, 10%"))
ggplot(roc, aes(s, roc, colour = distortion)) +
  geom_line(linewidth = 0.8) +
  scale_x_log10() +
  labs(x = "exceedance probability s of the layer", y = "return on capital of the layer",
       colour = NULL, title = "Return on capital by layer") +
  theme(legend.position = "top")
0.000.250.500.751.000.0010.0100.1001.000exceedance probability s of the layerreturn on capital of the layerPH, rho 0.5PH, rho 0.7CCoC, 10%Return on capital by layer

Premium of the Simple Discrete Example of Part I as a function of the assets, under the PH with rho 0.5 (book values from Tables 11.1 and 11.3):

OUTCOMES <- c(0, 1, 8, 9, 10, 11, 90, 98, 100)
SIXTEENTHS <- c(4, 2, 2, 1, 2, 1, 2, 1, 1)
draws <- rep(OUTCOMES, SIXTEENTHS)
ph <- distortion("proportional_hazard", 0.5)
rows <- lapply(c(10, 50, 80, 90, 100), function(a) {
  capped <- sampled(pmin(draws, a))
  premium <- risk_measure(capped, ph)
  book <- c(`80` = 42.828, `100` = 51.156)[as.character(a)]
  c(mean(capped), premium, unname(book), premium - mean(capped), a - premium)
})
table_cap <- data.frame(assets = c("10", "50", "80", "90", "100"), do.call(rbind, rows))
names(table_cap)[-1] <- c("mean", "premium", "book", "margin", "capital")
gt(table_cap, rowname_col = "assets") |>
  tab_header("Premium of the loss capped at the assets", "PH with rho 0.5 on the Simple Discrete Example") |>
  fmt_number(columns = everything(), decimals = 3) |>
  sub_missing(missing_text = "") |>
  cols_label(mean = "E[X ^ a]", premium = "PH premium", book = "book premium")
Premium of the loss capped at the assets
PH with rho 0.5 on the Simple Discrete Example
E[X ^ a] PH premium book premium margin capital
10 6.062 7.769
1.706 2.231
50 16.125 27.828
11.703 22.172
80 23.625 42.828 42.828 19.203 37.172
90 26.125 47.828
21.703 42.172
100 27.250 51.156 51.156 23.906 48.844

Premium funds most of the low layers, because losses consume them in most outcomes. From 11 to 90, losses consume each added unit of assets only in the 25% of outcomes above 11, so each unit adds g(0.25) = 0.5 of premium and 0.5 of capital. The top layers add mostly capital.

6. Calibrating the five distortions

Chapter 11 compares SRMs that charge the same total premium. The five families are CCoC, proportional hazard (PH), Wang, dual power and TVaR, calibrated to the gross CCoC premium of section 2. A sixth, “Blend”, is piecewise linear and built from layer costs of capital. Table 11.5 prints the calibrated parameters:

FAMILIES <- c("ccoc", "ph", "wang", "dual", "tvar")
BOOK_115 <- list(Tame = c(0.10, 0.683, 0.375, 1.576, 0.227), `Cat/Non-Cat` = c(0.10, 0.596, 0.611, 2.463, 0.482))
fitted <- list()
rows <- list()
for (b in list(list(name = "Tame", book = tame, p = 0.9999), list(name = "Cat/Non-Cat", book = cnc, p = 0.999))) {
  fitted[[b$name]] <- sapply(FAMILIES, function(f) calibrate_portfolio(b$book, f, p = b$p, return_on_capital = 0.10),
                             simplify = FALSE)
  rows[[length(rows) + 1]] <- unname(sapply(fitted[[b$name]], function(d) d@param[1]))
  rows[[length(rows) + 1]] <- BOOK_115[[b$name]]
}
table_115 <- data.frame(book = interleave(names(BOOK_115)), do.call(rbind, rows))
names(table_115)[-1] <- FAMILIES
pair_table(table_115, setNames(rep(3, 5), FAMILIES)) |>
  tab_header("Table 11.5: calibrated parameters", "Each family calibrated to the gross CCoC premium")
Table 11.5: calibrated parameters
Each family calibrated to the gross CCoC premium
ccoc ph wang dual tvar
Tame 0.100 0.683 0.375 1.576 0.227
Tame, book 0.1 0.683 0.375 1.576 0.227
Cat/Non-Cat 0.100 0.596 0.611 2.463 0.482
Cat/Non-Cat, book 0.1 0.596 0.611 2.463 0.482

All ten parameters agree. calibrate_portfolio() returns a distortion(). Its param is the return r for "ccoc", the exponent rho for PH, the shift lambda for Wang, the exponent beta for dual power and the level p for TVaR.

The case studies guide runs both books at 99.9% against aggregate 0.30.1; the book’s Tame uses 99.99%.

The Blend of Exercise 197 (Table 11.6) sets a layer cost of capital nu at some exceedance probabilities s, from 2% for the most remote layers to 10% at s = 0.2. At each point g(s) = (s + nu) / (1 + nu), and the Blend interpolates between them. distortion_convex() builds the smallest concave distortion through such points. The book’s point at s = 0.03 is below the line through its neighbours, so it is lifted slightly:

LAYER_S <- c(0.0, 0.01, 0.03, 0.05, 0.10, 0.20)
LAYER_NU <- c(0.02, 0.03, 0.04, 0.06, 0.08, 0.10)
specified <- (LAYER_S + LAYER_NU) / (1 + LAYER_NU)
blend <- distortion_convex(c(LAYER_S, 1), c(specified, 1))
table_blend <- data.frame(s = as.character(LAYER_S), nu = LAYER_NU, specified = specified,
                          blend = distortion_g(blend, LAYER_S))
gt(table_blend, rowname_col = "s") |>
  tab_header("Table 11.6: the Blend through layer costs of capital", "g(s) at the specified points") |>
  fmt_percent(columns = "nu", decimals = 0) |>
  fmt_number(columns = c("specified", "blend"), decimals = 4) |>
  cols_label(nu = "cost of capital", specified = "specified g", blend = "Blend g")
Table 11.6: the Blend through layer costs of capital
g(s) at the specified points
cost of capital specified g Blend g
0 2% 0.0196 0.0000
0.01 3% 0.0388 0.0388
0.03 4% 0.0673 0.0713
0.05 6% 0.1038 0.1038
0.1 8% 0.1667 0.1667
0.2 10% 0.2727 0.2727

At s = 0 a distortion is 0 by definition. The specified 0.0196 is the mass at zero (the rate on line of the most remote layer), which distortion_mass() reports. The Blend is not calibrated, so both books use the same one.

cat("mass at zero of the Blend:", pyfloat(round(distortion_mass(blend), 4)), "
")
## mass at zero of the Blend: 0.0196

The six distortions of the Tame book. The grey line is g(s) = s, a layer priced at its expected loss; the distance above it is the margin:

points <- seq(0, 1, by = 0.01)
tame_g <- c(fitted$Tame, list(blend = blend))
curves <- do.call(rbind, lapply(names(tame_g), function(name) {
  data.frame(distortion = factor(name, levels = names(tame_g)), s = points,
             g = distortion_g(tame_g[[name]], points))
}))
ggplot(curves, aes(s, g)) +
  geom_abline(intercept = 0, slope = 1, colour = "grey75") +
  geom_line(linewidth = 0.8) +
  facet_wrap(~distortion, nrow = 2) +
  labs(x = "exceedance probability s", y = "g(s)", title = "The six distortions of the Tame book")
dualtvarblendccocphwang0.000.250.500.751.000.000.250.500.751.000.000.250.500.751.000.000.250.500.751.000.000.250.500.751.00exceedance probability sg(s)The six distortions of the Tame book

7. Pricing each unit with the five distortions

Tables 11.7 and 11.8 price each unit stand-alone under each calibrated distortion, at its own VaR, and the book total, gross and net. The code compares premiums only: the pentagon derives the other columns. The last column is the largest relative gap to the book in the row:

BOOK_117 <- list( # Table 11.7 (Tame) premiums: A, B, SoP, total; net B, net SoP, net total
  ccoc = c(51.89, 52.98, 104.9, 103.4, 50.98, 102.9, 101.5),
  ph = c(51.90, 52.89, 104.8, 103.4, 50.91, 102.8, 101.8),
  wang = c(51.90, 52.86, 104.8, 103.4, 51.17, 103.1, 102.0),
  dual = c(51.90, 52.83, 104.7, 103.4, 51.44, 103.3, 102.1),
  tvar = c(51.90, 52.81, 104.7, 103.4, 51.63, 103.5, 102.2),
  blend = c(51.05, 51.62, 102.7, 101.9, 50.03, 101.1, 100.5)
)
BOOK_118 <- list( # Table 11.8 (Cat/Non-Cat) premiums: Cat, Non-Cat, SoP, total; net Cat, net SoP, net total
  ccoc = c(34.98, 83.84, 118.8, 115.2, 25.72, 109.6, 105.9),
  ph = c(33.75, 86.36, 120.1, 115.2, 25.11, 111.5, 107.6),
  wang = c(32.82, 87.50, 120.3, 115.2, 25.68, 113.2, 108.8),
  dual = c(31.83, 88.59, 120.4, 115.2, 26.57, 115.2, 110.1),
  tvar = c(31.15, 89.17, 120.3, 115.2, 26.88, 116.0, 110.9),
  blend = c(26.43, 82.39, 108.8, 106.8, 21.17, 103.6, 101.8)
)

by_unit <- function(gross, net, p, distortions, book_values, reinsured, labels, title) {
  rows <- list()
  for (name in names(distortions)) {
    g <- price_stand_alone(gross, distortions[[name]], p)
    n <- price_stand_alone(net, distortions[[name]], p)
    got <- c(g$premium[1:2], g$premium[g$unit == "sum"], g$premium[g$unit == "total"],
             n$premium[reinsured], n$premium[n$unit == "sum"], n$premium[n$unit == "total"])
    book <- book_values[[name]]
    rows[[length(rows) + 1]] <- c(got, max(abs(got / book - 1)))
    rows[[length(rows) + 1]] <- c(book, NA)
  }
  frame <- data.frame(distortion = interleave(names(distortions)), do.call(rbind, rows), check.names = FALSE)
  names(frame)[-1] <- c(labels, "gap")
  pair_table(frame, setNames(rep(2, length(labels)), labels)) |>
    fmt_percent(columns = "gap", rows = seq(1, nrow(frame), by = 2), decimals = 2) |>
    tab_header(title, "Premiums in currency units") |>
    tab_spanner("gross", columns = labels[1:4]) |>
    tab_spanner("net", columns = labels[5:7])
}

by_unit(tame, tame_net, 0.9999, c(fitted$Tame, list(blend = blend)), BOOK_117, 2,
        c("A", "B", "SoP", "total", "B net", "SoP net", "net total"), "Table 11.7: Tame premiums by distortion")
Table 11.7: Tame premiums by distortion
Premiums in currency units
gross
net
gap
A B SoP total B net SoP net net total
ccoc 51.89 52.98 104.87 103.42 50.98 102.86 101.55 0.05%
ccoc, book 51.89 52.98 104.9 103.4 50.98 102.9 101.5
ph 51.90 52.89 104.79 103.42 50.91 102.80 101.85 0.05%
ph, book 51.9 52.89 104.8 103.4 50.91 102.8 101.8
wang 51.90 52.86 104.76 103.42 51.17 103.07 101.99 0.04%
wang, book 51.9 52.86 104.8 103.4 51.17 103.1 102
dual 51.90 52.83 104.73 103.42 51.44 103.34 102.11 0.04%
dual, book 51.9 52.83 104.7 103.4 51.44 103.3 102.1
tvar 51.90 52.81 104.71 103.42 51.62 103.53 102.24 0.04%
tvar, book 51.9 52.81 104.7 103.4 51.63 103.5 102.2
blend 51.05 51.62 102.67 101.89 50.03 101.08 100.53 0.03%
blend, book 51.05 51.62 102.7 101.9 50.03 101.1 100.5
by_unit(cnc, cnc_net, 0.999, c(fitted$`Cat/Non-Cat`, list(blend = blend)), BOOK_118, 1,
        c("Cat", "Non-Cat", "SoP", "total", "Cat net", "SoP net", "net total"),
        "Table 11.8: Cat/Non-Cat premiums by distortion")
Table 11.8: Cat/Non-Cat premiums by distortion
Premiums in currency units
gross
net
gap
Cat Non-Cat SoP total Cat net SoP net net total
ccoc 34.98 83.84 118.81 115.15 25.72 109.56 105.90 0.04%
ccoc, book 34.98 83.84 118.8 115.2 25.72 109.6 105.9
ph 33.75 86.36 120.11 115.15 25.11 111.47 107.55 0.04%
ph, book 33.75 86.36 120.1 115.2 25.11 111.5 107.6
wang 32.82 87.50 120.32 115.15 25.68 113.18 108.79 0.04%
wang, book 32.82 87.5 120.3 115.2 25.68 113.2 108.8
dual 31.83 88.59 120.42 115.15 26.57 115.16 110.13 0.04%
dual, book 31.83 88.59 120.4 115.2 26.57 115.2 110.1
tvar 31.15 89.17 120.32 115.15 26.88 116.05 110.88 0.04%
tvar, book 31.15 89.17 120.3 115.2 26.88 116 110.9
blend 26.43 82.39 108.82 106.76 21.17 103.56 101.82 0.04%
blend, book 26.43 82.39 108.8 106.8 21.17 103.6 101.8

Every premium agrees to within one in the book’s last printed digit.

By construction, the five distortions charge the gross book the same price. They disagree about the units alone and about the net book. In Cat/Non-Cat, the Cat cover (gross minus net premium) is worth 9.3 under the CCoC and 4.3 under TVaR, so its value depends on the distortion that the capital providers use. The figure shows both effects (Table 11.8):

cover <- data.frame(
  distortion = factor(rep(names(BOOK_118), 2), levels = names(BOOK_118)),
  panel = rep(c("Cat alone", "Value of the Cat cover"), each = length(BOOK_118)),
  value = c(sapply(BOOK_118, `[`, 1), sapply(BOOK_118, function(b) b[4] - b[7]))
)
cover$panel <- factor(cover$panel, levels = c("Cat alone", "Value of the Cat cover"))
ggplot(cover, aes(distortion, value)) +
  geom_col() +
  facet_wrap(~panel, scales = "free_y") +
  labs(x = "distortion", y = "currency units (premium; gross less net premium)",
       title = "Cat/Non-Cat: Cat alone and the value of the Cat cover")
Cat aloneValue of the Cat coverccocphwangdualtvarblendccocphwangdualtvarblend0.02.55.07.50102030distortioncurrency units (premium; gross less net premium)Cat/Non-Cat: Cat alone and the value of the Cat cover

Exercise 200 asks what reinsurance price is attractive. There is no answer until you choose the distortion. The Blend is not calibrated, and it charges less than the others because the cost of its remote capital is low (2% to 10%).

8. When an indicator is priced below its expected value

Section 11.7 resolves an apparent paradox. In a portfolio priced by g, the risk-adjusted probability of “the loss is at most x” is 1 - g(S(x)), below its true probability F(x). So a policy that pays 1 in good years seems to be priced below its expected loss.

Stand-alone, this is not true. As its own risk, the indicator is a Bernoulli with probability F(x), priced at g(F(x)), above F(x). The book uses a lognormal with mean 10 and CV 0.5 and a PH with rho 0.7:

x_loss <- lognormal_from_mean_cv(10, 0.5)
ph7 <- distortion("proportional_hazard", 0.7)
for (p in c(0.5, 0.9)) {
  x0 <- quantile(x_loss, p)
  cat(sprintf("x = %6.3f: P(X <= x) %.2f, stand-alone price %.3f, price as a part of X %.3f\n",
              x0, p, distortion_g(ph7, p), 1 - distortion_g(ph7, 1 - p)))
}
## x =  8.944: P(X <= x) 0.50, stand-alone price 0.616, price as a part of X 0.384
## x = 16.385: P(X <= x) 0.90, stand-alone price 0.929, price as a part of X 0.800
elapsed <- as.numeric(difftime(Sys.time(), started, units = "secs"))
cat(sprintf("(run time of this guide: %s 15 s)\n", if (elapsed < 15) "under" else "over"))
## (run time of this guide: under 15 s)

In the portfolio, the indicator pays in the states that the distortion gives less weight, so it is worth less than its expected value. It is a hedge, and selling it is like buying reinsurance. Alone, the underwriter orders the states by the outcome of the indicator and charges a margin. The same difference, price in a portfolio against price alone, explains the stand-alone columns of section 7.