# Price allocation in *Pricing Insurance Risk*: classical methods, the natural allocation and Bodoff

Part III of Stephen Mildenhall and John Major's *Pricing Insurance Risk: Theory and Practice* (Wiley, 2022), chapters 12 to 15, asks how to split a portfolio's price over its units. Chapter 12 gives the classical answers, which allocate capital first and then price it. Chapter 14 builds the book's own answer, the **natural allocation** of a spectral risk measure. Chapter 15 works it on small discrete examples and compares it with Bodoff's percentile layer of capital.

This guide runs the book's small examples in prospicio, with the book's values beside prospicio's. Exercise, example and table numbers are the book's.

New to distortions, CCoC or the pentagon? Read [CAS Monograph 15 reproduced](capital-modeling-monograph-15.md) first. The case studies of chapters 13 and 15 and the reinsurance evaluation of chapter 19 are in [Price allocation in practice](pir-price-allocation-practice.md).


# 1. The Simple Discrete Example

Most of chapter 12 uses the Simple Discrete Example (section 2.4.1): two independent units, `X1` on 0, 8 and 10 and `X2` on 0, 1 and 90, each with probabilities 1/2, 1/4 and 1/4. The nine joint outcomes have probabilities in multiples of 1/16, so sixteen equally likely rows give the portfolio exactly. The allocation functions need such equally likely simulations, a [PredictiveDistribution](../reference/distributions.PredictiveDistribution.md#prospicio.distributions.PredictiveDistribution):


``` python
from prospicio.distributions import PredictiveDistribution, Sampled
from prospicio.pricing import Portfolio
from prospicio.risk import Distortion, capital

X1 = {0: 2, 8: 1, 10: 1}  # value: weight out of 4
X2 = {0: 2, 1: 1, 90: 1}
ROWS = [[float(a), float(b)] for a, n in X1.items() for b, m in X2.items() for _ in range(n * m)]
sims = PredictiveDistribution(["unit"], [("X1",), ("X2",)], ROWS)
discrete = Portfolio(["X1", "X2"], ROWS)
x1, x2 = Sampled([r[0] for r in ROWS]), Sampled([r[1] for r in ROWS])
print(len(ROWS), "rows; means", x1.mean(), x2.mean(), "total", x1.mean() + x2.mean())
print("totals", discrete.totals)
```


    16 rows; means 4.5 22.75 total 27.25
    totals [0.0, 1.0, 8.0, 9.0, 10.0, 11.0, 90.0, 98.0, 100.0]


`X2` is the dangerous unit: one year in four it loses 90.


# 2. The classical recipes (chapter 12)

Chapter 12 starts from allocated constant cost of capital (CCoC) pricing: each unit gets capital and pays the same return on it. In Exercise 203 three units have an expected loss of 100 and capital of 40, 80 and 200. At 12% their premiums are 104.8, 109.6 and 124.0. The premium depends on the capital allocation, so the chapter examines the common recipes.

The chapter allocates two amounts: the TVaR of the total at 75% (94.5) and a premium of 80. [capital](../reference/risk.capital.md#prospicio.risk.capital) takes a distortion (here TVaR) and a method:

- `"euler"`: the co-measure. For TVaR it is the coTVaR, each unit's average loss in the worst quarter of years.
- `"marginal"`: Merton and Perold's saving when the unit is removed.
- `"shapley"`: the Shapley value of the game whose cost is the TVaR of each sub-portfolio.
- `"proportional"`: the stand-alone measures, scaled to the total.


``` python
tvar75 = Distortion.tvar(0.75)
print(f"TVaR 75% of the total: {capital(sims, tvar75).total}  (book 94.5)")
```


    TVaR 75% of the total: 94.5  (book 94.5)


Tables 12.5 and 12.8, with the book's values under prospicio's:


``` python
import pandas as pd
from great_tables import GT


def pair_table(frame, decimals):
    """A table whose rows are prospicio's, each followed by the book's row, named 'x, book'."""
    names = list(frame.iloc[:, 0])
    book = [i for i, name in enumerate(names) if name.endswith(", book")]
    mine = [i for i in range(len(names)) if i not in book]
    table = GT(frame, rowname_col=frame.columns[0])
    for column, places in decimals.items():
        table = table.fmt_number(column, rows=mine, decimals=places, use_seps=False)
        table = table.fmt_number(column, rows=book, decimals=places, drop_trailing_zeros=True, use_seps=False)
    return table.sub_missing(missing_text="")


NAN = float("nan")
BOOK_12 = {"euler": (4.5, 90), "marginal": (4.5, 84.5), "shapley": (7.25, 87.25)}
rows = []
for method in ("euler", "marginal", "shapley", "proportional"):
    a = capital(sims, tvar75, method)
    rows.append((method, *a.allocated))
    if method in BOOK_12:
        rows.append((f"{method}, book", *BOOK_12[method]))
rows += [("stand-alone", *a.standalone), ("stand-alone, book", 10, 90)]
(pair_table(pd.DataFrame(rows, columns=["method", "X1", "X2"]), {"X1": 2, "X2": 2})
 .tab_header("Tables 12.5 and 12.8: the TVaR 75% of the total (94.5) by unit", "Currency units"))
```


<style>
#viruyupfco table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#viruyupfco thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#viruyupfco p { margin: 0; padding: 0; }
 #viruyupfco .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #viruyupfco .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #viruyupfco .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #viruyupfco .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #viruyupfco .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #viruyupfco .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #viruyupfco .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #viruyupfco .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #viruyupfco .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #viruyupfco .gt_column_spanner_outer:first-child { padding-left: 0; }
 #viruyupfco .gt_column_spanner_outer:last-child { padding-right: 0; }
 #viruyupfco .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #viruyupfco .gt_spanner_row { border-bottom-style: hidden; }
 #viruyupfco .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #viruyupfco .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #viruyupfco .gt_from_md> :first-child { margin-top: 0; }
 #viruyupfco .gt_from_md> :last-child { margin-bottom: 0; }
 #viruyupfco .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #viruyupfco .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #viruyupfco .gt_indent_1 { text-indent: 5px; }
 #viruyupfco .gt_indent_2 { text-indent: calc(5px * 2); }
 #viruyupfco .gt_indent_3 { text-indent: calc(5px * 3); }
 #viruyupfco .gt_indent_4 { text-indent: calc(5px * 4); }
 #viruyupfco .gt_indent_5 { text-indent: calc(5px * 5); }
 #viruyupfco .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #viruyupfco .gt_row_group_first td { border-top-width: 2px; }
 #viruyupfco .gt_row_group_first th { border-top-width: 2px; }
 #viruyupfco .gt_striped { color: #333333; background-color: #F4F4F4; }
 #viruyupfco .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #viruyupfco .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #viruyupfco .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #viruyupfco .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #viruyupfco .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #viruyupfco .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #viruyupfco .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #viruyupfco .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #viruyupfco .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #viruyupfco .gt_left { text-align: left; }
 #viruyupfco .gt_center { text-align: center; }
 #viruyupfco .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #viruyupfco .gt_font_normal { font-weight: normal; }
 #viruyupfco .gt_font_bold { font-weight: bold; }
 #viruyupfco .gt_font_italic { font-style: italic; }
 #viruyupfco .gt_super { font-size: 65%; }
 #viruyupfco .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #viruyupfco .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #viruyupfco .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #viruyupfco .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #viruyupfco .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #viruyupfco .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="3" id="title" class="gt_heading gt_title gt_font_normal">Tables 12.5 and 12.8: the TVaR 75% of the total (94.5) by unit</th>
</tr>
<tr class="gt_heading">
<th colspan="3" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Currency units</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">X1</th>
<th id="X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">X2</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">euler</th>
<td class="gt_row gt_right" headers="stub-1 X1">4.50</td>
<td class="gt_row gt_right" headers="stub-1 X2">90.00</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">euler, book</th>
<td class="gt_row gt_right" headers="stub-2 X1">4.5</td>
<td class="gt_row gt_right" headers="stub-2 X2">90</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">marginal</th>
<td class="gt_row gt_right" headers="stub-3 X1">4.50</td>
<td class="gt_row gt_right" headers="stub-3 X2">84.50</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">marginal, book</th>
<td class="gt_row gt_right" headers="stub-4 X1">4.5</td>
<td class="gt_row gt_right" headers="stub-4 X2">84.5</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">shapley</th>
<td class="gt_row gt_right" headers="stub-5 X1">7.25</td>
<td class="gt_row gt_right" headers="stub-5 X2">87.25</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">shapley, book</th>
<td class="gt_row gt_right" headers="stub-6 X1">7.25</td>
<td class="gt_row gt_right" headers="stub-6 X2">87.25</td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">proportional</th>
<td class="gt_row gt_right" headers="stub-7 X1">9.45</td>
<td class="gt_row gt_right" headers="stub-7 X2">85.05</td>
</tr>
<tr>
<th id="stub-8" class="gt_row gt_left gt_stub" scope="row">stand-alone</th>
<td class="gt_row gt_right" headers="stub-8 X1">10.00</td>
<td class="gt_row gt_right" headers="stub-8 X2">90.00</td>
</tr>
<tr>
<th id="stub-9" class="gt_row gt_left gt_stub" scope="row">stand-alone, book</th>
<td class="gt_row gt_right" headers="stub-9 X1">10</td>
<td class="gt_row gt_right" headers="stub-9 X2">90</td>
</tr>
</tbody>
</table>


The marginal amounts add up to 89, not 94.5: no single unit causes the last 5.5, so the method gives it to no unit. The coTVaR gives `X1` only its expected loss of 4.5, so `X1` gets no margin: in the worst quarter of years `X2` loses 90 and `X1` loses no more than usual. Shapley averages the stand-alone and marginal views.

Exercise 211 also allocates a premium of 80. [Portfolio.calibrate](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.calibrate) finds the TVaR level that prices the total at 80:


``` python
d80 = discrete.calibrate("tvar", premium=80.0)
print(f"TVaR level pricing the total at 80: {d80.parameters['p']:.4f}  (book 0.6975)")
BOOK_80 = {"stand-alone": (9.65, 74.54), "marginal": (5.46, 70.35), "shapley": (7.55, 72.45)}
MEANS = (4.5, 22.75)
split80 = []  # label, X1, X2, loss ratio of X1, loss ratio of X2


def add_split(label, got, book, ratios):
    split80.append((label, *got, *([m / g for m, g in zip(MEANS, got)] if ratios else [NAN, NAN])))
    split80.append((f"{label}, book", *book, *ratios_book.get(label, (NAN, NAN))))


ratios_book = {"shapley": (0.596, 0.314), "haircut": (0.563, 0.316)}
a = capital(sims, d80, "shapley")
add_split("stand-alone", a.standalone, BOOK_80["stand-alone"], False)
add_split("marginal", capital(sims, d80, "marginal").allocated, BOOK_80["marginal"], True)
add_split("shapley", a.allocated, BOOK_80["shapley"], True)
```


    TVaR level pricing the total at 80: 0.6975  (book 0.6975)


Exercises 205 and 206 use each unit's stand-alone TVaR. The haircut splits the 80 in proportion to the TVaRs at 75% (10 and 90). The equal risk allocation finds the level [p](../reference/models.Elpd.md#prospicio.models.Elpd.p) at which the stand-alone TVaRs add up to 80, which prices each unit as if the two were comonotonic. A bisection finds [p](../reference/models.Elpd.md#prospicio.models.Elpd.p):


``` python
t75 = [x1.tvar(0.75), x2.tvar(0.75)]
add_split("haircut", [80 * t / sum(t75) for t in t75], (8, 72), True)
lo, hi = 0.5, 0.75
for _ in range(60):  # bisection on the level p
    p = (lo + hi) / 2
    lo, hi = (lo, p) if x1.tvar(p) + x2.tvar(p) > 80 else (p, hi)
add_split("equal risk", [x1.tvar(p), x2.tvar(p)], (9.56, 70.44), True)
print(f"equal risk level {p:.4f} (book 0.6796)")
```


    equal risk level 0.6796 (book 0.6796)


``` python
(pair_table(pd.DataFrame(split80, columns=["method", "X1", "X2", "LR X1", "LR X2"]),
            {"X1": 2, "X2": 2, "LR X1": 4, "LR X2": 4})
 .tab_header("Exercises 205, 206 and 211: a premium of 80 split five ways",
             "Currency units; LR is the expected loss over the allocated premium"))
```


<style>
#cdwkbbiqhd table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#cdwkbbiqhd thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#cdwkbbiqhd p { margin: 0; padding: 0; }
 #cdwkbbiqhd .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #cdwkbbiqhd .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #cdwkbbiqhd .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #cdwkbbiqhd .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #cdwkbbiqhd .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #cdwkbbiqhd .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #cdwkbbiqhd .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #cdwkbbiqhd .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #cdwkbbiqhd .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #cdwkbbiqhd .gt_column_spanner_outer:first-child { padding-left: 0; }
 #cdwkbbiqhd .gt_column_spanner_outer:last-child { padding-right: 0; }
 #cdwkbbiqhd .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #cdwkbbiqhd .gt_spanner_row { border-bottom-style: hidden; }
 #cdwkbbiqhd .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #cdwkbbiqhd .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #cdwkbbiqhd .gt_from_md> :first-child { margin-top: 0; }
 #cdwkbbiqhd .gt_from_md> :last-child { margin-bottom: 0; }
 #cdwkbbiqhd .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #cdwkbbiqhd .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #cdwkbbiqhd .gt_indent_1 { text-indent: 5px; }
 #cdwkbbiqhd .gt_indent_2 { text-indent: calc(5px * 2); }
 #cdwkbbiqhd .gt_indent_3 { text-indent: calc(5px * 3); }
 #cdwkbbiqhd .gt_indent_4 { text-indent: calc(5px * 4); }
 #cdwkbbiqhd .gt_indent_5 { text-indent: calc(5px * 5); }
 #cdwkbbiqhd .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #cdwkbbiqhd .gt_row_group_first td { border-top-width: 2px; }
 #cdwkbbiqhd .gt_row_group_first th { border-top-width: 2px; }
 #cdwkbbiqhd .gt_striped { color: #333333; background-color: #F4F4F4; }
 #cdwkbbiqhd .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #cdwkbbiqhd .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #cdwkbbiqhd .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #cdwkbbiqhd .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #cdwkbbiqhd .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #cdwkbbiqhd .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #cdwkbbiqhd .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #cdwkbbiqhd .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #cdwkbbiqhd .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #cdwkbbiqhd .gt_left { text-align: left; }
 #cdwkbbiqhd .gt_center { text-align: center; }
 #cdwkbbiqhd .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #cdwkbbiqhd .gt_font_normal { font-weight: normal; }
 #cdwkbbiqhd .gt_font_bold { font-weight: bold; }
 #cdwkbbiqhd .gt_font_italic { font-style: italic; }
 #cdwkbbiqhd .gt_super { font-size: 65%; }
 #cdwkbbiqhd .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #cdwkbbiqhd .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #cdwkbbiqhd .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #cdwkbbiqhd .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #cdwkbbiqhd .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #cdwkbbiqhd .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="5" id="title" class="gt_heading gt_title gt_font_normal">Exercises 205, 206 and 211: a premium of 80 split five ways</th>
</tr>
<tr class="gt_heading">
<th colspan="5" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Currency units; LR is the expected loss over the allocated premium</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">X1</th>
<th id="X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">X2</th>
<th id="LR-X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">LR X1</th>
<th id="LR-X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">LR X2</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">stand-alone</th>
<td class="gt_row gt_right" headers="stub-1 X1">9.65</td>
<td class="gt_row gt_right" headers="stub-1 X2">74.54</td>
<td class="gt_row gt_right" headers="stub-1 LR-X1"></td>
<td class="gt_row gt_right" headers="stub-1 LR-X2"></td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">stand-alone, book</th>
<td class="gt_row gt_right" headers="stub-2 X1">9.65</td>
<td class="gt_row gt_right" headers="stub-2 X2">74.54</td>
<td class="gt_row gt_right" headers="stub-2 LR-X1"></td>
<td class="gt_row gt_right" headers="stub-2 LR-X2"></td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">marginal</th>
<td class="gt_row gt_right" headers="stub-3 X1">5.46</td>
<td class="gt_row gt_right" headers="stub-3 X2">70.35</td>
<td class="gt_row gt_right" headers="stub-3 LR-X1">0.8249</td>
<td class="gt_row gt_right" headers="stub-3 LR-X2">0.3234</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">marginal, book</th>
<td class="gt_row gt_right" headers="stub-4 X1">5.46</td>
<td class="gt_row gt_right" headers="stub-4 X2">70.35</td>
<td class="gt_row gt_right" headers="stub-4 LR-X1"></td>
<td class="gt_row gt_right" headers="stub-4 LR-X2"></td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">shapley</th>
<td class="gt_row gt_right" headers="stub-5 X1">7.55</td>
<td class="gt_row gt_right" headers="stub-5 X2">72.45</td>
<td class="gt_row gt_right" headers="stub-5 LR-X1">0.5957</td>
<td class="gt_row gt_right" headers="stub-5 LR-X2">0.3140</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">shapley, book</th>
<td class="gt_row gt_right" headers="stub-6 X1">7.55</td>
<td class="gt_row gt_right" headers="stub-6 X2">72.45</td>
<td class="gt_row gt_right" headers="stub-6 LR-X1">0.596</td>
<td class="gt_row gt_right" headers="stub-6 LR-X2">0.314</td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">haircut</th>
<td class="gt_row gt_right" headers="stub-7 X1">8.00</td>
<td class="gt_row gt_right" headers="stub-7 X2">72.00</td>
<td class="gt_row gt_right" headers="stub-7 LR-X1">0.5625</td>
<td class="gt_row gt_right" headers="stub-7 LR-X2">0.3160</td>
</tr>
<tr>
<th id="stub-8" class="gt_row gt_left gt_stub" scope="row">haircut, book</th>
<td class="gt_row gt_right" headers="stub-8 X1">8</td>
<td class="gt_row gt_right" headers="stub-8 X2">72</td>
<td class="gt_row gt_right" headers="stub-8 LR-X1">0.563</td>
<td class="gt_row gt_right" headers="stub-8 LR-X2">0.316</td>
</tr>
<tr>
<th id="stub-9" class="gt_row gt_left gt_stub" scope="row">equal risk</th>
<td class="gt_row gt_right" headers="stub-9 X1">9.56</td>
<td class="gt_row gt_right" headers="stub-9 X2">70.44</td>
<td class="gt_row gt_right" headers="stub-9 LR-X1">0.4707</td>
<td class="gt_row gt_right" headers="stub-9 LR-X2">0.3230</td>
</tr>
<tr>
<th id="stub-10" class="gt_row gt_left gt_stub" scope="row">equal risk, book</th>
<td class="gt_row gt_right" headers="stub-10 X1">9.56</td>
<td class="gt_row gt_right" headers="stub-10 X2">70.44</td>
<td class="gt_row gt_right" headers="stub-10 LR-X1"></td>
<td class="gt_row gt_right" headers="stub-10 LR-X2"></td>
</tr>
</tbody>
</table>


Every row matches. The recipes split the same 80 as 8 and 72, 9.56 and 70.44, or 7.55 and 72.45, and nothing says which split is correct.


## The covariance allocation: two definitions

Exercise 217 uses Kalkbrener's method with the standard deviation as auxiliary measure: each unit gets its expected loss plus a share of the margin `80 - 27.25` in proportion to its covariance with the total. prospicio's `"covariance"` method spreads the whole measure, expected loss included, by `rho(S) Cov(X_j, S) / Var(S)`. The covariance shares are the same, so the book's version follows from them:


``` python
cov = capital(sims, d80, "covariance")
shares = [x / cov.total for x in cov.allocated]  # Cov(X_j, S) / Var(S)
kalkbrener = [m + (80 - 27.25) * s for m, s in zip((4.5, 22.75), shares)]
print(f"prospicio 'covariance'  X1 {cov.allocated[0]:7.3f}  X2 {cov.allocated[1]:7.3f}")
print(f"mean plus covariance    X1 {kalkbrener[0]:7.3f}  X2 {kalkbrener[1]:7.3f}   book 5.216, 74.784")
print(f"loss ratios {4.5 / kalkbrener[0]:.3f}, {22.75 / kalkbrener[1]:.3f}  (book 0.863, 0.304)")
```


    prospicio 'covariance'  X1   1.086  X2  78.914
    mean plus covariance    X1   5.216  X2  74.784   book 5.216, 74.784
    loss ratios 0.863, 0.304  (book 0.863, 0.304)


`X1` is almost uncorrelated with the total (covariance 20.75, variance 1,528), so spreading all of 80 by covariance gives it 1.09, a quarter of its expected loss. No insurer charges that. The book's form keeps the expected loss and allocates only the margin.


## Equal priority in default

Section 12.3: when an insurer cannot pay all claims, equal priority pays each the same fraction of what is owed. Exercise 219 has assets of 1,200 against liabilities of 800, 600 and 400. A one-scenario [Portfolio](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio) reports each line's recovery as its [loss](../reference/pricing.Pentagon.md#prospicio.pricing.Pentagon.loss), and [Portfolio.priority](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.priority) adds the senior and junior rules:


``` python
owed = Portfolio(["A", "B", "C"], [[800.0, 600.0, 400.0]])
paid = owed.price(Distortion.ccoc(0.1), assets=1200).allocated
print("equal priority:", [round(u.loss, 1) for u in paid], " (book 533, 400, 267)")
ladder = owed.priority(assets=1200)
print("A senior, equal, junior:", ladder["senior"][0], round(ladder["equal"][0], 1), ladder["junior"][0])
```


    equal priority: [533.3, 400.0, 266.7]  (book 533, 400, 267)
    A senior, equal, junior: 800.0 533.3 200.0


Each line gets two thirds. Ranked behind B and C, A would get only 200.


# 3. The natural allocation, layer by layer (chapter 14)

Chapter 14 prices the portfolio with a spectral risk measure (a distortion [g](../reference/pricing.Mbbefd.md#prospicio.pricing.Mbbefd.g) of the survival function `S` of the total) and then allocates the premium:

1.  Sort the outcomes by the **total** loss. Each total `x_k` gets the weight `g(S(x_k-)) - g(S(x_k))`: more than its probability if the total is bad, less if it is good. The weights add up to 1, and the premium is the expected total under them.
2.  A unit's premium is its expected loss under the **same** weights. They depend only on the total, so a unit needs only its average loss at each total, `kappa_i(x) = E[X_i | X = x]`. The [kappa](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.kappa) values add up to the total, so the unit premiums add up to the portfolio premium.
3.  Read the result as layers. A layer of assets between two consecutive totals costs `g(S)` times its width, against an expected loss of `S` times its width. Each unit pays in proportion to its expected contribution to the losses that reach the layer. A unit's return depends on the layers it uses. Allocated CCoC pricing does the opposite: one return, allocated capital.

Example 258 runs the algorithm on an adjusted Simple Discrete Example: `X1` takes 9 instead of 8, so the total 10 has two causes (9 + 1 and 10 + 0). The distortion is the proportional hazard `g(s) = s^0.5`. At a total of 10 the averages are 9.6667 for `X1` and 0.3333 for `X2`:


``` python
ADJ_ROWS = [[x1, x2] for x1 in (0.0, 9.0, 10.0) for x2 in (0.0, 1.0, 90.0)]
ADJ_PROBS = [p1 * p2 for p1 in (0.5, 0.25, 0.25) for p2 in (0.5, 0.25, 0.25)]
adjusted = Portfolio(["X1", "X2"], ADJ_ROWS, ADJ_PROBS)
ph = Distortion.proportional_hazard(0.5)
kappas = pd.DataFrame({
    "total": [f"{x:.0f}" for x in adjusted.totals],
    "prob": adjusted.probs,
    "kappa1": adjusted.kappa("X1"),
    "kappa2": adjusted.kappa("X2"),
})
(GT(kappas, rowname_col="total")
 .tab_header("Table 15.3: the units' average losses given the total", "Example 258, by total loss of the portfolio")
 .fmt_number("prob", decimals=4)
 .fmt_number(["kappa1", "kappa2"], decimals=4, use_seps=False))
```


<style>
#gvcncwzkqs table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#gvcncwzkqs thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#gvcncwzkqs p { margin: 0; padding: 0; }
 #gvcncwzkqs .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #gvcncwzkqs .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #gvcncwzkqs .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #gvcncwzkqs .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #gvcncwzkqs .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #gvcncwzkqs .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #gvcncwzkqs .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #gvcncwzkqs .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #gvcncwzkqs .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #gvcncwzkqs .gt_column_spanner_outer:first-child { padding-left: 0; }
 #gvcncwzkqs .gt_column_spanner_outer:last-child { padding-right: 0; }
 #gvcncwzkqs .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #gvcncwzkqs .gt_spanner_row { border-bottom-style: hidden; }
 #gvcncwzkqs .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #gvcncwzkqs .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #gvcncwzkqs .gt_from_md> :first-child { margin-top: 0; }
 #gvcncwzkqs .gt_from_md> :last-child { margin-bottom: 0; }
 #gvcncwzkqs .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #gvcncwzkqs .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #gvcncwzkqs .gt_indent_1 { text-indent: 5px; }
 #gvcncwzkqs .gt_indent_2 { text-indent: calc(5px * 2); }
 #gvcncwzkqs .gt_indent_3 { text-indent: calc(5px * 3); }
 #gvcncwzkqs .gt_indent_4 { text-indent: calc(5px * 4); }
 #gvcncwzkqs .gt_indent_5 { text-indent: calc(5px * 5); }
 #gvcncwzkqs .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #gvcncwzkqs .gt_row_group_first td { border-top-width: 2px; }
 #gvcncwzkqs .gt_row_group_first th { border-top-width: 2px; }
 #gvcncwzkqs .gt_striped { color: #333333; background-color: #F4F4F4; }
 #gvcncwzkqs .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #gvcncwzkqs .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #gvcncwzkqs .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #gvcncwzkqs .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #gvcncwzkqs .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #gvcncwzkqs .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #gvcncwzkqs .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #gvcncwzkqs .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #gvcncwzkqs .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #gvcncwzkqs .gt_left { text-align: left; }
 #gvcncwzkqs .gt_center { text-align: center; }
 #gvcncwzkqs .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #gvcncwzkqs .gt_font_normal { font-weight: normal; }
 #gvcncwzkqs .gt_font_bold { font-weight: bold; }
 #gvcncwzkqs .gt_font_italic { font-style: italic; }
 #gvcncwzkqs .gt_super { font-size: 65%; }
 #gvcncwzkqs .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #gvcncwzkqs .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #gvcncwzkqs .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #gvcncwzkqs .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #gvcncwzkqs .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #gvcncwzkqs .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="4" id="title" class="gt_heading gt_title gt_font_normal">Table 15.3: the units' average losses given the total</th>
</tr>
<tr class="gt_heading">
<th colspan="4" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Example 258, by total loss of the portfolio</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="prob" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">prob</th>
<th id="kappa1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">kappa1</th>
<th id="kappa2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">kappa2</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">0</th>
<td class="gt_row gt_right" headers="stub-1 prob">0.2500</td>
<td class="gt_row gt_right" headers="stub-1 kappa1">0.0000</td>
<td class="gt_row gt_right" headers="stub-1 kappa2">0.0000</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">1</th>
<td class="gt_row gt_right" headers="stub-2 prob">0.1250</td>
<td class="gt_row gt_right" headers="stub-2 kappa1">0.0000</td>
<td class="gt_row gt_right" headers="stub-2 kappa2">1.0000</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">9</th>
<td class="gt_row gt_right" headers="stub-3 prob">0.1250</td>
<td class="gt_row gt_right" headers="stub-3 kappa1">9.0000</td>
<td class="gt_row gt_right" headers="stub-3 kappa2">0.0000</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">10</th>
<td class="gt_row gt_right" headers="stub-4 prob">0.1875</td>
<td class="gt_row gt_right" headers="stub-4 kappa1">9.6667</td>
<td class="gt_row gt_right" headers="stub-4 kappa2">0.3333</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">11</th>
<td class="gt_row gt_right" headers="stub-5 prob">0.0625</td>
<td class="gt_row gt_right" headers="stub-5 kappa1">10.0000</td>
<td class="gt_row gt_right" headers="stub-5 kappa2">1.0000</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">90</th>
<td class="gt_row gt_right" headers="stub-6 prob">0.1250</td>
<td class="gt_row gt_right" headers="stub-6 kappa1">0.0000</td>
<td class="gt_row gt_right" headers="stub-6 kappa2">90.0000</td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">99</th>
<td class="gt_row gt_right" headers="stub-7 prob">0.0625</td>
<td class="gt_row gt_right" headers="stub-7 kappa1">9.0000</td>
<td class="gt_row gt_right" headers="stub-7 kappa2">90.0000</td>
</tr>
<tr>
<th id="stub-8" class="gt_row gt_left gt_stub" scope="row">100</th>
<td class="gt_row gt_right" headers="stub-8 prob">0.0625</td>
<td class="gt_row gt_right" headers="stub-8 kappa1">10.0000</td>
<td class="gt_row gt_right" headers="stub-8 kappa2">90.0000</td>
</tr>
</tbody>
</table>


The premiums are those of Table 15.4 to four decimals:


``` python
priced = adjusted.price(ph, assets=100)
print("premium", [round(u.premium, 4) for u in priced.allocated], round(priced.total.premium, 4),
      " (book 6.2048, 45.1838, 51.3887)")
```


    premium [6.2048, 45.1838] 51.3887  (book 6.2048, 45.1838, 51.3887)


``` python
import matplotlib.pyplot as plt

labels = [f"{x:.0f}" for x in adjusted.totals]
k1, k2 = adjusted.kappa("X1"), adjusted.kappa("X2")
fig, ax = plt.subplots()
ax.bar(labels, k1, label="X1")
ax.bar(labels, k2, bottom=k1, label="X2")
ax.set_xlabel("total loss of the portfolio")
ax.set_ylabel("average loss of the unit given the total")
ax.set_title("Example 258: the units' average losses add up to each total")
ax.legend()
```


<figure class="p-figure figure">
DogdmFyKC0tcC1tdXRlZCkiIHg9IjQzLjE5NzEwOSIgeT0iNzQuMDE2ODM2IiB0cmFuc2Zvcm09InJvdGF0ZSgtMCA0My4xOTcxMDkgNzQuMDE2ODM2KSI+ODA8L3RleHQ+CiAgICAgPC9nPgogICAgPC9nPgogICAgPGcgaWQ9Inl0aWNrXzYiPgogICAgIDxnIGlkPSJsaW5lMmRfMjciPgogICAgICA8cGF0aCBkPSJNIDUwLjE5NzEwOSAzMS44MjIxMjUgCkwgNDQwLjc5NzEwOSAzMS44MjIxMjUgCiIgY2xpcC1wYXRoPSJ1cmwoI3AwNjVlMjYxNzBkKSIgc3R5bGU9ImZpbGw6IG5vbmU7IHN0cm9rZTogdmFyKC0tcC1ydWxlKTsgc3Ryb2tlLXdpZHRoOiAwLjg7IHN0cm9rZS1saW5lY2FwOiBzcXVhcmUiIC8+CiAgICAgPC9nPgogICAgIDxnIGlkPSJsaW5lMmRfMjgiPgogICAgICA8Zz4KICAgICAgIDx1c2UgaHJlZj0iI201NWE5OWQyZTA1IiB4PSI1MC4xOTcxMDkiIHk9IjMxLjgyMjEyNSIgc3R5bGU9ImZpbGw6IHZhcigtLXAtbXV0ZWQpOyBzdHJva2U6IHZhcigtLXAtbXV0ZWQpOyBzdHJva2Utd2lkdGg6IDAuOCIgLz4KICAgICAgPC9nPgogICAgIDwvZz4KICAgICA8ZyBpZD0idGV4dF8xNSI+CiAgICAgIDx0ZXh0IHN0eWxlPSJmb250LXNpemU6IDExcHg7IGZvbnQtZmFtaWx5OiB2YXIoLS1wLWZvbnQpOyB0ZXh0LWFuY2hvcjogZW5kOyBmaWxs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OSIgeT0iNDAuNTc2NDA2IiB0cmFuc2Zvcm09InJvdGF0ZSgtMCA5MC44OTcxMDkgNDAuNTc2NDA2KSI+WDE8L3RleHQ+CiAgICA8L2c+CiAgICA8ZyBpZD0icGF0Y2hfMjIiPgogICAgIDxwYXRoIGQ9Ik0gNjAuMDk3MTA5IDU3LjA3NzI2NiAKTCA4Mi4wOTcxMDkgNTcuMDc3MjY2IApMIDgyLjA5NzEwOSA0OS4zNzcyNjYgCkwgNjAuMDk3MTA5IDQ5LjM3NzI2NiAKegoiIHN0eWxlPSJmaWxsOiB2YXIoLS1wLXNlcmllcy0yKSIgLz4KICAgIDwvZz4KICAgIDxnIGlkPSJ0ZXh0XzE5Ij4KICAgICA8dGV4dCBzdHlsZT0iZm9udC1zaXplOiAxMXB4OyBmb250LWZhbWlseTogdmFyKC0tcC1mb250KTsgdGV4dC1hbmNob3I6IHN0YXJ0OyBmaWxsOiB2YXIoLS1wLWluaykiIHg9IjkwLjg5NzEwOSIgeT0iNTcuMDc3MjY2IiB0cmFuc2Zvcm09InJvdGF0ZSgtMCA5MC44OTcxMDkgNTcuMDc3MjY2KSI+WDI8L3RleHQ+CiAgICA8L2c+CiAgIDwvZz4KICA8L2c+CiA8L2c+CiA8ZGVmcz4KICA8Y2xpcHBhdGggaWQ9InAwNjVlMjYxNzBkIj4KICAgPHJlY3QgeD0iNTAuMTk3MTA5IiB5PSIyMi4zMTgxMjUiIHdpZHRoPSIzOTAuNiIgaGVpZ2h0PSIxOTkuNTg0IiAvPgogIDwvY2xpcHBhdGg+CiA8L2RlZnM+Cjwvc3ZnPg==" />
</figure>


## When totals tie: the natural allocation set

When outcomes tie on the total, the distortion cannot rank them, and each order gives a valid allocation. These form the **natural allocation set**, and the [kappa](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.kappa) average (the **linear natural allocation**) is in it. Example 259 gives the extreme orders of the tie at 10: `X1` gets 6.2085 or 6.2009. Exercise 260 does the same for TVaR at 65%: `X1` gets 6.1429 or 6.2500 and `X2` 64.5714 or 64.4643. The linear allocation lies between:


``` python
linear65 = [u.premium for u in adjusted.price(Distortion.tvar(0.65), assets=100).allocated]
print(f"TVaR 65%: X1 {linear65[0]:.4f} (book range 6.1429 to 6.2500),"
      f" X2 {linear65[1]:.4f} (book range 64.4643 to 64.5714)")
```


    TVaR 65%: X1 6.2143 (book range 6.1429 to 6.2500), X2 64.5000 (book range 64.4643 to 64.5714)


# 4. Limited assets: the linear and lifted allocations

With assets [a](../reference/distributions.Beta.md#prospicio.distributions.Beta.a) below the largest loss, the insurer pays `X ∧ a`, and under equal priority unit `i` gets `X_i a / X` when the total exceeds [a](../reference/distributions.Beta.md#prospicio.distributions.Beta.a). All default outcomes share the capped total [a](../reference/distributions.Beta.md#prospicio.distributions.Beta.a): a tie, so the natural allocation is not unique. Chapter 14 selects two members:

- **Linear**: all default outcomes count alike. The default event's weight is split by each unit's expected share of the payments in default.
- **Lifted**: default outcomes are ranked by the uncapped total `X`, so the worst defaults get the most weight. It measures the size of default.

[Portfolio.price](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.price) takes `allocation="linear"` or `"lifted"`. Example 235 has ten equally likely outcomes, assets of 10 and TVaR at 80%. Four totals exceed 10:


``` python
E235_X1 = [1, 2, 3, 4, 5, 6, 7, 8, 12, 10]
E235_X2 = [1, 2, 3, 4, 5, 9, 8, 12, 13, 20]
e235 = Portfolio(["X1", "X2"], [[float(a), float(b)] for a, b in zip(E235_X1, E235_X2)])
tvar80 = Distortion.tvar(0.8)
rows = []
for allocation, book in (("lifted", (4.067, 5.933)), ("linear", (4.3, 5.7))):
    for assets, label in ((10, "10"), (10 - 1e-9, "10 - 1e-9")):
        got = [u.premium for u in e235.price(tvar80, assets=assets, allocation=allocation).allocated]
        rows.append((f"{allocation}, assets {label}", *got, *book))
(GT(pd.DataFrame(rows, columns=["case", "X1", "X2", "book X1", "book X2"]), rowname_col="case")
 .tab_header("Example 235: premium by unit, TVaR 80%", "Ten equally likely outcomes; currency units")
 .fmt_number(["X1", "X2"], decimals=4, use_seps=False)
 .fmt_number(["book X1", "book X2"], decimals=3, drop_trailing_zeros=True, use_seps=False))
```


<style>
#wvyadwioyi table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#wvyadwioyi thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#wvyadwioyi p { margin: 0; padding: 0; }
 #wvyadwioyi .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #wvyadwioyi .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #wvyadwioyi .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #wvyadwioyi .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #wvyadwioyi .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #wvyadwioyi .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #wvyadwioyi .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #wvyadwioyi .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #wvyadwioyi .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #wvyadwioyi .gt_column_spanner_outer:first-child { padding-left: 0; }
 #wvyadwioyi .gt_column_spanner_outer:last-child { padding-right: 0; }
 #wvyadwioyi .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #wvyadwioyi .gt_spanner_row { border-bottom-style: hidden; }
 #wvyadwioyi .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #wvyadwioyi .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #wvyadwioyi .gt_from_md> :first-child { margin-top: 0; }
 #wvyadwioyi .gt_from_md> :last-child { margin-bottom: 0; }
 #wvyadwioyi .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #wvyadwioyi .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #wvyadwioyi .gt_indent_1 { text-indent: 5px; }
 #wvyadwioyi .gt_indent_2 { text-indent: calc(5px * 2); }
 #wvyadwioyi .gt_indent_3 { text-indent: calc(5px * 3); }
 #wvyadwioyi .gt_indent_4 { text-indent: calc(5px * 4); }
 #wvyadwioyi .gt_indent_5 { text-indent: calc(5px * 5); }
 #wvyadwioyi .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #wvyadwioyi .gt_row_group_first td { border-top-width: 2px; }
 #wvyadwioyi .gt_row_group_first th { border-top-width: 2px; }
 #wvyadwioyi .gt_striped { color: #333333; background-color: #F4F4F4; }
 #wvyadwioyi .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #wvyadwioyi .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #wvyadwioyi .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #wvyadwioyi .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #wvyadwioyi .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #wvyadwioyi .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #wvyadwioyi .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #wvyadwioyi .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #wvyadwioyi .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #wvyadwioyi .gt_left { text-align: left; }
 #wvyadwioyi .gt_center { text-align: center; }
 #wvyadwioyi .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #wvyadwioyi .gt_font_normal { font-weight: normal; }
 #wvyadwioyi .gt_font_bold { font-weight: bold; }
 #wvyadwioyi .gt_font_italic { font-style: italic; }
 #wvyadwioyi .gt_super { font-size: 65%; }
 #wvyadwioyi .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #wvyadwioyi .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #wvyadwioyi .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #wvyadwioyi .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #wvyadwioyi .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #wvyadwioyi .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="5" id="title" class="gt_heading gt_title gt_font_normal">Example 235: premium by unit, TVaR 80%</th>
</tr>
<tr class="gt_heading">
<th colspan="5" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Ten equally likely outcomes; currency units</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">X1</th>
<th id="X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">X2</th>
<th id="book-X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">book X1</th>
<th id="book-X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">book X2</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">lifted, assets 10</th>
<td class="gt_row gt_right" headers="stub-1 X1">4.0667</td>
<td class="gt_row gt_right" headers="stub-1 X2">5.9333</td>
<td class="gt_row gt_right" headers="stub-1 book-X1">4.067</td>
<td class="gt_row gt_right" headers="stub-1 book-X2">5.933</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">lifted, assets 10 - 1e-9</th>
<td class="gt_row gt_right" headers="stub-2 X1">4.0667</td>
<td class="gt_row gt_right" headers="stub-2 X2">5.9333</td>
<td class="gt_row gt_right" headers="stub-2 book-X1">4.067</td>
<td class="gt_row gt_right" headers="stub-2 book-X2">5.933</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">linear, assets 10</th>
<td class="gt_row gt_right" headers="stub-3 X1">4.1600</td>
<td class="gt_row gt_right" headers="stub-3 X2">5.8400</td>
<td class="gt_row gt_right" headers="stub-3 book-X1">4.3</td>
<td class="gt_row gt_right" headers="stub-3 book-X2">5.7</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">linear, assets 10 - 1e-9</th>
<td class="gt_row gt_right" headers="stub-4 X1">4.3000</td>
<td class="gt_row gt_right" headers="stub-4 X2">5.7000</td>
<td class="gt_row gt_right" headers="stub-4 book-X1">4.3</td>
<td class="gt_row gt_right" headers="stub-4 book-X2">5.7</td>
</tr>
</tbody>
</table>


The lifted allocation agrees with the book at assets of 10 and gives more to `X2`, which dominates the two worst outcomes. The linear allocation agrees only slightly below 10, because one outcome totals exactly 10, the asset level.

The book counts an outcome at exactly the asset level as a default. prospicio follows [aggregate](../reference/aggregate.Clash.md#prospicio.aggregate.Clash.aggregate) 1.0.1: it pays that outcome in full and splits the default weight over outcomes above [a](../reference/distributions.Beta.md#prospicio.distributions.Beta.a). The total price is the same. Assets of `a - 1e-9` give the book's linear numbers.

Example 263 prices the adjusted example with assets of 80, so three outcomes default:


``` python
got = adjusted.price(ph, assets=80, allocation="lifted").allocated
print(f"assets 80, lifted: loss {got[0].loss:.4f}, {got[1].loss:.4f}"
      f"  premium {got[0].premium:.4f}, {got[1].premium:.4f}")
print("            book: loss 4.5170, 19.2955  premium 5.5260, 37.4307")
```


    assets 80, lifted: loss 4.5170, 19.2955  premium 5.5260, 37.4307
                book: loss 4.5170, 19.2955  premium 5.5260, 37.4307


``` python
TWO_ROWS = [[a, b] for a in (0.0, 10.0, 20.0) for b in (0.0, 10.0, 40.0)]
TWO_PROBS = [p * q for p in (0.5, 0.25, 0.25) for q in (0.5, 0.25, 0.25)]
two = Portfolio(["X1", "X2"], TWO_ROWS, TWO_PROBS)
ph87 = Distortion.proportional_hazard(0.87)
BOOK_1520 = {  # assets: lifted X1, X2, linear X1, X2, total
    10: (3.5622, 4.2236, 3.6983, 4.0875, 7.7858),
    20: (5.9672, 7.2901, 6.2183, 7.0390, 13.2573),
    30: (6.8419, 10.0505, 6.8350, 10.0574, 16.8924),
    40: (7.2890, 12.5971, 7.0972, 12.7889, 19.8861),
    50: (7.7361, 13.7880, 7.6846, 13.8395, 21.5241),
    60: (8.0348, 14.3855, 8.0348, 14.3855, 22.4203),
}
largest, rows = 0.0, []
for a, book in BOOK_1520.items():
    lifted = two.price(ph87, assets=a, allocation="lifted")
    linear = two.price(ph87, assets=a - 1e-9, allocation="linear")
    got = [u.premium for u in lifted.allocated] + [u.premium for u in linear.allocated]
    got.append(lifted.total.premium)
    largest = max(largest, *(abs(g - b) for g, b in zip(got, book)))
    rows.append((str(a), *got))
columns = ["assets", "lifted X1", "lifted X2", "linear X1", "linear X2", "total"]
(GT(pd.DataFrame(rows, columns=columns), rowname_col="assets")
 .tab_header("Table 15.20: premium by unit and assets", "Example 272, proportional hazard 0.87")
 .fmt_number(columns[1:], decimals=4, use_seps=False))
```


<style>
#ahcuwtqpob table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#ahcuwtqpob thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#ahcuwtqpob p { margin: 0; padding: 0; }
 #ahcuwtqpob .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #ahcuwtqpob .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #ahcuwtqpob .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #ahcuwtqpob .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #ahcuwtqpob .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #ahcuwtqpob .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #ahcuwtqpob .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #ahcuwtqpob .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #ahcuwtqpob .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #ahcuwtqpob .gt_column_spanner_outer:first-child { padding-left: 0; }
 #ahcuwtqpob .gt_column_spanner_outer:last-child { padding-right: 0; }
 #ahcuwtqpob .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #ahcuwtqpob .gt_spanner_row { border-bottom-style: hidden; }
 #ahcuwtqpob .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #ahcuwtqpob .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #ahcuwtqpob .gt_from_md> :first-child { margin-top: 0; }
 #ahcuwtqpob .gt_from_md> :last-child { margin-bottom: 0; }
 #ahcuwtqpob .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #ahcuwtqpob .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #ahcuwtqpob .gt_indent_1 { text-indent: 5px; }
 #ahcuwtqpob .gt_indent_2 { text-indent: calc(5px * 2); }
 #ahcuwtqpob .gt_indent_3 { text-indent: calc(5px * 3); }
 #ahcuwtqpob .gt_indent_4 { text-indent: calc(5px * 4); }
 #ahcuwtqpob .gt_indent_5 { text-indent: calc(5px * 5); }
 #ahcuwtqpob .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #ahcuwtqpob .gt_row_group_first td { border-top-width: 2px; }
 #ahcuwtqpob .gt_row_group_first th { border-top-width: 2px; }
 #ahcuwtqpob .gt_striped { color: #333333; background-color: #F4F4F4; }
 #ahcuwtqpob .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #ahcuwtqpob .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #ahcuwtqpob .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #ahcuwtqpob .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #ahcuwtqpob .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #ahcuwtqpob .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #ahcuwtqpob .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #ahcuwtqpob .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #ahcuwtqpob .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #ahcuwtqpob .gt_left { text-align: left; }
 #ahcuwtqpob .gt_center { text-align: center; }
 #ahcuwtqpob .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #ahcuwtqpob .gt_font_normal { font-weight: normal; }
 #ahcuwtqpob .gt_font_bold { font-weight: bold; }
 #ahcuwtqpob .gt_font_italic { font-style: italic; }
 #ahcuwtqpob .gt_super { font-size: 65%; }
 #ahcuwtqpob .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #ahcuwtqpob .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #ahcuwtqpob .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #ahcuwtqpob .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #ahcuwtqpob .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #ahcuwtqpob .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="6" id="title" class="gt_heading gt_title gt_font_normal">Table 15.20: premium by unit and assets</th>
</tr>
<tr class="gt_heading">
<th colspan="6" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Example 272, proportional hazard 0.87</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="lifted-X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">lifted X1</th>
<th id="lifted-X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">lifted X2</th>
<th id="linear-X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">linear X1</th>
<th id="linear-X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">linear X2</th>
<th id="total" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">total</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">10</th>
<td class="gt_row gt_right" headers="stub-1 lifted-X1">3.5622</td>
<td class="gt_row gt_right" headers="stub-1 lifted-X2">4.2236</td>
<td class="gt_row gt_right" headers="stub-1 linear-X1">3.6983</td>
<td class="gt_row gt_right" headers="stub-1 linear-X2">4.0875</td>
<td class="gt_row gt_right" headers="stub-1 total">7.7858</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">20</th>
<td class="gt_row gt_right" headers="stub-2 lifted-X1">5.9672</td>
<td class="gt_row gt_right" headers="stub-2 lifted-X2">7.2901</td>
<td class="gt_row gt_right" headers="stub-2 linear-X1">6.2183</td>
<td class="gt_row gt_right" headers="stub-2 linear-X2">7.0390</td>
<td class="gt_row gt_right" headers="stub-2 total">13.2573</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">30</th>
<td class="gt_row gt_right" headers="stub-3 lifted-X1">6.8419</td>
<td class="gt_row gt_right" headers="stub-3 lifted-X2">10.0505</td>
<td class="gt_row gt_right" headers="stub-3 linear-X1">6.8350</td>
<td class="gt_row gt_right" headers="stub-3 linear-X2">10.0574</td>
<td class="gt_row gt_right" headers="stub-3 total">16.8924</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">40</th>
<td class="gt_row gt_right" headers="stub-4 lifted-X1">7.2890</td>
<td class="gt_row gt_right" headers="stub-4 lifted-X2">12.5971</td>
<td class="gt_row gt_right" headers="stub-4 linear-X1">7.0972</td>
<td class="gt_row gt_right" headers="stub-4 linear-X2">12.7889</td>
<td class="gt_row gt_right" headers="stub-4 total">19.8861</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">50</th>
<td class="gt_row gt_right" headers="stub-5 lifted-X1">7.7361</td>
<td class="gt_row gt_right" headers="stub-5 lifted-X2">13.7880</td>
<td class="gt_row gt_right" headers="stub-5 linear-X1">7.6846</td>
<td class="gt_row gt_right" headers="stub-5 linear-X2">13.8395</td>
<td class="gt_row gt_right" headers="stub-5 total">21.5241</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">60</th>
<td class="gt_row gt_right" headers="stub-6 lifted-X1">8.0348</td>
<td class="gt_row gt_right" headers="stub-6 lifted-X2">14.3855</td>
<td class="gt_row gt_right" headers="stub-6 linear-X1">8.0348</td>
<td class="gt_row gt_right" headers="stub-6 linear-X2">14.3855</td>
<td class="gt_row gt_right" headers="stub-6 total">22.4203</td>
</tr>
</tbody>
</table>


``` python
print(f"largest gap to the book's thirty numbers: {largest:.1e}")
```


    largest gap to the book's thirty numbers: 4.6e-05


Example 272 prices two independent units at several asset levels (Table 15.20). All thirty numbers match to four decimals. The lifted allocation puts more on `X2` at assets of 20 and 30, where `X2`'s loss of 40 makes the worst defaults. At 60 nothing defaults, so the two agree.


# 5. Margin and capital by unit (section 15.2)

The layer view gives each unit a margin and a capital in each layer of assets. Margin is premium density minus expected loss density, and in each layer capital and margin keep the ratio the distortion sets, `(1 - g(S)) / (g(S) - S)`. A unit's capital is the sum over layers, and its return is margin over capital. [capital](../reference/risk.capital.md#prospicio.risk.capital) on the lifted allocation gives this sum (section 15.2.5, Tables 15.14 and 15.15):


``` python
FUNDING_BOOK = {  # margins, capitals and returns of X1, X2 as the book prints them
    100: (1.4548, 22.4338, 3.5274, 45.0839, 0.4124, 0.4976),
    80: (1.0089, 18.1353, NAN, NAN, 0.4151, 0.5239),
    11: (-0.5423, 2.4365, NAN, NAN, NAN, NAN),
}
rows = []
for a, book in FUNDING_BOOK.items():
    u1, u2 = adjusted.price(ph, assets=a, allocation="lifted").allocated
    m1, m2 = u1.premium - u1.loss, u2.premium - u2.loss
    rows.append((f"assets {a}", m1, m2, u1.capital, u2.capital, m1 / u1.capital, m2 / u2.capital))
    rows.append((f"assets {a}, book", *book))
columns = ["assets", "margin X1", "margin X2", "capital X1", "capital X2", "return X1", "return X2"]
(pair_table(pd.DataFrame(rows, columns=columns), {c: 4 for c in columns[1:]})
 .tab_header("Tables 15.14 and 15.15: margin, capital and return by unit", "Lifted allocation; return is margin over capital"))
```


<style>
#tswkscyrnu table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#tswkscyrnu thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#tswkscyrnu p { margin: 0; padding: 0; }
 #tswkscyrnu .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #tswkscyrnu .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #tswkscyrnu .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #tswkscyrnu .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #tswkscyrnu .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #tswkscyrnu .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #tswkscyrnu .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #tswkscyrnu .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #tswkscyrnu .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #tswkscyrnu .gt_column_spanner_outer:first-child { padding-left: 0; }
 #tswkscyrnu .gt_column_spanner_outer:last-child { padding-right: 0; }
 #tswkscyrnu .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #tswkscyrnu .gt_spanner_row { border-bottom-style: hidden; }
 #tswkscyrnu .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #tswkscyrnu .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #tswkscyrnu .gt_from_md> :first-child { margin-top: 0; }
 #tswkscyrnu .gt_from_md> :last-child { margin-bottom: 0; }
 #tswkscyrnu .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #tswkscyrnu .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #tswkscyrnu .gt_indent_1 { text-indent: 5px; }
 #tswkscyrnu .gt_indent_2 { text-indent: calc(5px * 2); }
 #tswkscyrnu .gt_indent_3 { text-indent: calc(5px * 3); }
 #tswkscyrnu .gt_indent_4 { text-indent: calc(5px * 4); }
 #tswkscyrnu .gt_indent_5 { text-indent: calc(5px * 5); }
 #tswkscyrnu .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #tswkscyrnu .gt_row_group_first td { border-top-width: 2px; }
 #tswkscyrnu .gt_row_group_first th { border-top-width: 2px; }
 #tswkscyrnu .gt_striped { color: #333333; background-color: #F4F4F4; }
 #tswkscyrnu .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #tswkscyrnu .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #tswkscyrnu .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #tswkscyrnu .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #tswkscyrnu .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #tswkscyrnu .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #tswkscyrnu .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #tswkscyrnu .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #tswkscyrnu .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #tswkscyrnu .gt_left { text-align: left; }
 #tswkscyrnu .gt_center { text-align: center; }
 #tswkscyrnu .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #tswkscyrnu .gt_font_normal { font-weight: normal; }
 #tswkscyrnu .gt_font_bold { font-weight: bold; }
 #tswkscyrnu .gt_font_italic { font-style: italic; }
 #tswkscyrnu .gt_super { font-size: 65%; }
 #tswkscyrnu .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #tswkscyrnu .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #tswkscyrnu .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #tswkscyrnu .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #tswkscyrnu .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #tswkscyrnu .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="7" id="title" class="gt_heading gt_title gt_font_normal">Tables 15.14 and 15.15: margin, capital and return by unit</th>
</tr>
<tr class="gt_heading">
<th colspan="7" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Lifted allocation; return is margin over capital</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="margin-X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">margin X1</th>
<th id="margin-X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">margin X2</th>
<th id="capital-X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">capital X1</th>
<th id="capital-X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">capital X2</th>
<th id="return-X1" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">return X1</th>
<th id="return-X2" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">return X2</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">assets 100</th>
<td class="gt_row gt_right" headers="stub-1 margin-X1">1.4548</td>
<td class="gt_row gt_right" headers="stub-1 margin-X2">22.4338</td>
<td class="gt_row gt_right" headers="stub-1 capital-X1">3.5274</td>
<td class="gt_row gt_right" headers="stub-1 capital-X2">45.0839</td>
<td class="gt_row gt_right" headers="stub-1 return-X1">0.4124</td>
<td class="gt_row gt_right" headers="stub-1 return-X2">0.4976</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">assets 100, book</th>
<td class="gt_row gt_right" headers="stub-2 margin-X1">1.4548</td>
<td class="gt_row gt_right" headers="stub-2 margin-X2">22.4338</td>
<td class="gt_row gt_right" headers="stub-2 capital-X1">3.5274</td>
<td class="gt_row gt_right" headers="stub-2 capital-X2">45.0839</td>
<td class="gt_row gt_right" headers="stub-2 return-X1">0.4124</td>
<td class="gt_row gt_right" headers="stub-2 return-X2">0.4976</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">assets 80</th>
<td class="gt_row gt_right" headers="stub-3 margin-X1">1.0089</td>
<td class="gt_row gt_right" headers="stub-3 margin-X2">18.1353</td>
<td class="gt_row gt_right" headers="stub-3 capital-X1">2.4305</td>
<td class="gt_row gt_right" headers="stub-3 capital-X2">34.6128</td>
<td class="gt_row gt_right" headers="stub-3 return-X1">0.4151</td>
<td class="gt_row gt_right" headers="stub-3 return-X2">0.5239</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">assets 80, book</th>
<td class="gt_row gt_right" headers="stub-4 margin-X1">1.0089</td>
<td class="gt_row gt_right" headers="stub-4 margin-X2">18.1353</td>
<td class="gt_row gt_right" headers="stub-4 capital-X1"></td>
<td class="gt_row gt_right" headers="stub-4 capital-X2"></td>
<td class="gt_row gt_right" headers="stub-4 return-X1">0.4151</td>
<td class="gt_row gt_right" headers="stub-4 return-X2">0.5239</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">assets 11</th>
<td class="gt_row gt_right" headers="stub-5 margin-X1">−0.5423</td>
<td class="gt_row gt_right" headers="stub-5 margin-X2">2.4365</td>
<td class="gt_row gt_right" headers="stub-5 capital-X1">−0.6720</td>
<td class="gt_row gt_right" headers="stub-5 capital-X2">3.2153</td>
<td class="gt_row gt_right" headers="stub-5 return-X1">0.8070</td>
<td class="gt_row gt_right" headers="stub-5 return-X2">0.7578</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">assets 11, book</th>
<td class="gt_row gt_right" headers="stub-6 margin-X1">−0.5423</td>
<td class="gt_row gt_right" headers="stub-6 margin-X2">2.4365</td>
<td class="gt_row gt_right" headers="stub-6 capital-X1"></td>
<td class="gt_row gt_right" headers="stub-6 capital-X2"></td>
<td class="gt_row gt_right" headers="stub-6 return-X1"></td>
<td class="gt_row gt_right" headers="stub-6 return-X2"></td>
</tr>
</tbody>
</table>


Every value the book prints matches. At assets of 11, `X1` has a negative margin: default is so likely that `X2` takes payments from `X1` most of the time, and `X1` is paid for sharing its recoveries. Returns differ by unit (41% against 50% at full assets) because `X2` uses the expensive high layers.


# 6. Bodoff's percentile layer of capital (section 15.3)

Bodoff (2007) also allocates capital layer by layer, but with **objective** probabilities: the units share each layer in proportion to their expected share of the losses that reach it. His Thought Experiment 1 (section 15.3): a hurricane that costs 99 with probability 0.2 and an independent earthquake that costs 100 with probability 0.05. Assets are 100, equal priority, 10% cost of capital.


``` python
bodoff_book = Portfolio(["Hu", "EQ"], [[0.0, 0.0], [99.0, 0.0], [0.0, 100.0], [99.0, 100.0]],
                        [0.76, 0.19, 0.04, 0.01])
ccoc = Distortion.ccoc(0.1)
lifted = bodoff_book.price(ccoc, assets=100, allocation="lifted")
el = [u.loss for u in lifted.allocated]
total_epd, unit_epd = bodoff_book.epd(100)
plc_assets = bodoff_book.bodoff(assets=100)
shared = [a - e for a, e in zip(plc_assets, el)]
rows = [
    ("limited loss", *el, lifted.total.loss), ("limited loss, book", 19.3075, 4.5025, 23.81),
    ("EPD ratio", *unit_epd, total_epd), ("EPD ratio, book", 0.0249, 0.0995, 0.0399),
    ("PLC assets", *plc_assets, NAN),
    ("shared liability", *shared, NAN), ("shared liability, book", 61.2191, 14.9709, NAN),
]
(pair_table(pd.DataFrame(rows, columns=["measure", "Hu", "EQ", "total"]), {"Hu": 4, "EQ": 4, "total": 4})
 .tab_header("Bodoff's Thought Experiment 1", "Assets 100; PLC assets are Bodoff's shares of the assets"))
```


<style>
#awkvzggsxc table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#awkvzggsxc thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#awkvzggsxc p { margin: 0; padding: 0; }
 #awkvzggsxc .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #awkvzggsxc .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #awkvzggsxc .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #awkvzggsxc .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #awkvzggsxc .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #awkvzggsxc .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #awkvzggsxc .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #awkvzggsxc .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #awkvzggsxc .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #awkvzggsxc .gt_column_spanner_outer:first-child { padding-left: 0; }
 #awkvzggsxc .gt_column_spanner_outer:last-child { padding-right: 0; }
 #awkvzggsxc .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #awkvzggsxc .gt_spanner_row { border-bottom-style: hidden; }
 #awkvzggsxc .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #awkvzggsxc .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #awkvzggsxc .gt_from_md> :first-child { margin-top: 0; }
 #awkvzggsxc .gt_from_md> :last-child { margin-bottom: 0; }
 #awkvzggsxc .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #awkvzggsxc .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #awkvzggsxc .gt_indent_1 { text-indent: 5px; }
 #awkvzggsxc .gt_indent_2 { text-indent: calc(5px * 2); }
 #awkvzggsxc .gt_indent_3 { text-indent: calc(5px * 3); }
 #awkvzggsxc .gt_indent_4 { text-indent: calc(5px * 4); }
 #awkvzggsxc .gt_indent_5 { text-indent: calc(5px * 5); }
 #awkvzggsxc .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #awkvzggsxc .gt_row_group_first td { border-top-width: 2px; }
 #awkvzggsxc .gt_row_group_first th { border-top-width: 2px; }
 #awkvzggsxc .gt_striped { color: #333333; background-color: #F4F4F4; }
 #awkvzggsxc .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #awkvzggsxc .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #awkvzggsxc .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #awkvzggsxc .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #awkvzggsxc .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #awkvzggsxc .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #awkvzggsxc .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #awkvzggsxc .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #awkvzggsxc .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #awkvzggsxc .gt_left { text-align: left; }
 #awkvzggsxc .gt_center { text-align: center; }
 #awkvzggsxc .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #awkvzggsxc .gt_font_normal { font-weight: normal; }
 #awkvzggsxc .gt_font_bold { font-weight: bold; }
 #awkvzggsxc .gt_font_italic { font-style: italic; }
 #awkvzggsxc .gt_super { font-size: 65%; }
 #awkvzggsxc .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #awkvzggsxc .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #awkvzggsxc .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #awkvzggsxc .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #awkvzggsxc .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #awkvzggsxc .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="4" id="title" class="gt_heading gt_title gt_font_normal">Bodoff's Thought Experiment 1</th>
</tr>
<tr class="gt_heading">
<th colspan="4" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Assets 100; PLC assets are Bodoff's shares of the assets</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Hu</th>
<th id="EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">EQ</th>
<th id="total" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">total</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">limited loss</th>
<td class="gt_row gt_right" headers="stub-1 Hu">19.3075</td>
<td class="gt_row gt_right" headers="stub-1 EQ">4.5025</td>
<td class="gt_row gt_right" headers="stub-1 total">23.8100</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">limited loss, book</th>
<td class="gt_row gt_right" headers="stub-2 Hu">19.3075</td>
<td class="gt_row gt_right" headers="stub-2 EQ">4.5025</td>
<td class="gt_row gt_right" headers="stub-2 total">23.81</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">EPD ratio</th>
<td class="gt_row gt_right" headers="stub-3 Hu">0.0249</td>
<td class="gt_row gt_right" headers="stub-3 EQ">0.0995</td>
<td class="gt_row gt_right" headers="stub-3 total">0.0399</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">EPD ratio, book</th>
<td class="gt_row gt_right" headers="stub-4 Hu">0.0249</td>
<td class="gt_row gt_right" headers="stub-4 EQ">0.0995</td>
<td class="gt_row gt_right" headers="stub-4 total">0.0399</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">PLC assets</th>
<td class="gt_row gt_right" headers="stub-5 Hu">80.5266</td>
<td class="gt_row gt_right" headers="stub-5 EQ">19.4734</td>
<td class="gt_row gt_right" headers="stub-5 total"></td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">shared liability</th>
<td class="gt_row gt_right" headers="stub-6 Hu">61.2191</td>
<td class="gt_row gt_right" headers="stub-6 EQ">14.9709</td>
<td class="gt_row gt_right" headers="stub-6 total"></td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">shared liability, book</th>
<td class="gt_row gt_right" headers="stub-7 Hu">61.2191</td>
<td class="gt_row gt_right" headers="stub-7 EQ">14.9709</td>
<td class="gt_row gt_right" headers="stub-7 total"></td>
</tr>
</tbody>
</table>


[Portfolio.bodoff](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.bodoff) returns each unit's share of the assets; the share minus the expected loss is the shared liability (Table 15.22). PLC gives no price. The book splits each shared liability into margin and capital at the 10% return, so the margin is `0.1 / 1.1` of it (Table 15.24). The natural allocation instead prices the total with the CCoC distortion and allocates the premium (Tables 15.27, 15.29 and 15.30). The linear allocation uses assets of `a - 1e-9` (section 4: the earthquake alone totals exactly 100):


``` python
d = 0.1 / 1.1
plc_premium = [e + d * s for e, s in zip(el, shared)]
linear = bodoff_book.price(ccoc, assets=100 - 1e-9, allocation="linear")
l1, l2 = lifted.allocated
n1, n2 = linear.allocated
rows = [
    ("PLC", *plc_premium, sum(plc_premium), NAN, NAN),
    ("PLC, book", 24.8729, 5.8635, NAN, NAN, NAN),
    ("lifted", l1.premium, l2.premium, lifted.total.premium, l1.capital, l2.capital),
    ("lifted, book", 22.0749, 8.6615, 30.7364, 27.6739, 41.5898),
    ("linear", n1.premium, n2.premium, linear.total.premium, n1.capital, n2.capital),
    ("linear, book", 18.4568, 12.2796, NAN, -8.5070, 77.7707),
]
columns = ["method", "P Hu", "P EQ", "P total", "Q Hu", "Q EQ"]
(pair_table(pd.DataFrame(rows, columns=columns), {c: 4 for c in columns[1:]})
 .tab_header("Tables 15.27, 15.29 and 15.30: premium and capital by unit", "P is premium, Q is capital"))
```


<style>
#rxxxdptvlk table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#rxxxdptvlk thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#rxxxdptvlk p { margin: 0; padding: 0; }
 #rxxxdptvlk .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #rxxxdptvlk .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #rxxxdptvlk .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #rxxxdptvlk .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #rxxxdptvlk .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #rxxxdptvlk .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #rxxxdptvlk .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #rxxxdptvlk .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #rxxxdptvlk .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #rxxxdptvlk .gt_column_spanner_outer:first-child { padding-left: 0; }
 #rxxxdptvlk .gt_column_spanner_outer:last-child { padding-right: 0; }
 #rxxxdptvlk .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #rxxxdptvlk .gt_spanner_row { border-bottom-style: hidden; }
 #rxxxdptvlk .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #rxxxdptvlk .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #rxxxdptvlk .gt_from_md> :first-child { margin-top: 0; }
 #rxxxdptvlk .gt_from_md> :last-child { margin-bottom: 0; }
 #rxxxdptvlk .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #rxxxdptvlk .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #rxxxdptvlk .gt_indent_1 { text-indent: 5px; }
 #rxxxdptvlk .gt_indent_2 { text-indent: calc(5px * 2); }
 #rxxxdptvlk .gt_indent_3 { text-indent: calc(5px * 3); }
 #rxxxdptvlk .gt_indent_4 { text-indent: calc(5px * 4); }
 #rxxxdptvlk .gt_indent_5 { text-indent: calc(5px * 5); }
 #rxxxdptvlk .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #rxxxdptvlk .gt_row_group_first td { border-top-width: 2px; }
 #rxxxdptvlk .gt_row_group_first th { border-top-width: 2px; }
 #rxxxdptvlk .gt_striped { color: #333333; background-color: #F4F4F4; }
 #rxxxdptvlk .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #rxxxdptvlk .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #rxxxdptvlk .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #rxxxdptvlk .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #rxxxdptvlk .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #rxxxdptvlk .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #rxxxdptvlk .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #rxxxdptvlk .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #rxxxdptvlk .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #rxxxdptvlk .gt_left { text-align: left; }
 #rxxxdptvlk .gt_center { text-align: center; }
 #rxxxdptvlk .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #rxxxdptvlk .gt_font_normal { font-weight: normal; }
 #rxxxdptvlk .gt_font_bold { font-weight: bold; }
 #rxxxdptvlk .gt_font_italic { font-style: italic; }
 #rxxxdptvlk .gt_super { font-size: 65%; }
 #rxxxdptvlk .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #rxxxdptvlk .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #rxxxdptvlk .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #rxxxdptvlk .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #rxxxdptvlk .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #rxxxdptvlk .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="6" id="title" class="gt_heading gt_title gt_font_normal">Tables 15.27, 15.29 and 15.30: premium and capital by unit</th>
</tr>
<tr class="gt_heading">
<th colspan="6" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">P is premium, Q is capital</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="P-Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">P Hu</th>
<th id="P-EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">P EQ</th>
<th id="P-total" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">P total</th>
<th id="Q-Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Q Hu</th>
<th id="Q-EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Q EQ</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">PLC</th>
<td class="gt_row gt_right" headers="stub-1 P-Hu">24.8729</td>
<td class="gt_row gt_right" headers="stub-1 P-EQ">5.8635</td>
<td class="gt_row gt_right" headers="stub-1 P-total">30.7364</td>
<td class="gt_row gt_right" headers="stub-1 Q-Hu"></td>
<td class="gt_row gt_right" headers="stub-1 Q-EQ"></td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">PLC, book</th>
<td class="gt_row gt_right" headers="stub-2 P-Hu">24.8729</td>
<td class="gt_row gt_right" headers="stub-2 P-EQ">5.8635</td>
<td class="gt_row gt_right" headers="stub-2 P-total"></td>
<td class="gt_row gt_right" headers="stub-2 Q-Hu"></td>
<td class="gt_row gt_right" headers="stub-2 Q-EQ"></td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">lifted</th>
<td class="gt_row gt_right" headers="stub-3 P-Hu">22.0749</td>
<td class="gt_row gt_right" headers="stub-3 P-EQ">8.6615</td>
<td class="gt_row gt_right" headers="stub-3 P-total">30.7364</td>
<td class="gt_row gt_right" headers="stub-3 Q-Hu">27.6739</td>
<td class="gt_row gt_right" headers="stub-3 Q-EQ">41.5898</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">lifted, book</th>
<td class="gt_row gt_right" headers="stub-4 P-Hu">22.0749</td>
<td class="gt_row gt_right" headers="stub-4 P-EQ">8.6615</td>
<td class="gt_row gt_right" headers="stub-4 P-total">30.7364</td>
<td class="gt_row gt_right" headers="stub-4 Q-Hu">27.6739</td>
<td class="gt_row gt_right" headers="stub-4 Q-EQ">41.5898</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">linear</th>
<td class="gt_row gt_right" headers="stub-5 P-Hu">18.4568</td>
<td class="gt_row gt_right" headers="stub-5 P-EQ">12.2796</td>
<td class="gt_row gt_right" headers="stub-5 P-total">30.7364</td>
<td class="gt_row gt_right" headers="stub-5 Q-Hu">−8.5070</td>
<td class="gt_row gt_right" headers="stub-5 Q-EQ">77.7707</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">linear, book</th>
<td class="gt_row gt_right" headers="stub-6 P-Hu">18.4568</td>
<td class="gt_row gt_right" headers="stub-6 P-EQ">12.2796</td>
<td class="gt_row gt_right" headers="stub-6 P-total"></td>
<td class="gt_row gt_right" headers="stub-6 Q-Hu">−8.507</td>
<td class="gt_row gt_right" headers="stub-6 Q-EQ">77.7707</td>
</tr>
</tbody>
</table>


PLC charges the earthquake 5.86, close to its share of the expected loss. The lifted allocation charges 8.66: the CCoC distortion puts weight 0.1 on the worst outcome, and the earthquake is half of it. The linear allocation charges 12.28 and gives the hurricane a **negative** margin: it merges the earthquake-only year (total 100) and the year with both events into one default event of weight 0.1364, which the earthquake dominates. The lifted allocation avoids this by seeing through the cap, as PLC does.

Exercises 276 to 278 repeat this with a proportional hazard and a Wang transform calibrated to the same total. The book prints the parameters 0.82156 and 0.209615; calibrated to the CCoC premium here they are 0.821554 and 0.209615. The allocations use the printed ones:


``` python
BOOK_276 = {  # printed parameter, lifted premium and capital by unit, linear premium by unit
    "ph": (Distortion.proportional_hazard(0.82156), 0.82156, (23.3342, 7.4020, 40.0416, 29.2223), (23.0517, 7.6844)),
    "wang": (Distortion.wang(0.209615), 0.209615, (24.0282, 6.7082, 46.8427, 22.4209), (23.9277, 6.8087)),
}
rows = []
for family, (dist, parameter, book_lifted, book_linear) in BOOK_276.items():
    found = bodoff_book.calibrate(family, assets=100, premium=lifted.total.premium)
    li = bodoff_book.price(dist, assets=100, allocation="lifted").allocated
    ln = bodoff_book.price(dist, assets=100 - 1e-9, allocation="linear").allocated
    rows.append((family, list(found.parameters.values())[0], li[0].premium, li[1].premium, li[0].capital,
                 li[1].capital, ln[0].premium, ln[1].premium))
    rows.append((f"{family}, book", parameter, *book_lifted, *book_linear))
columns = ["family", "parameter", "P Hu", "P EQ", "Q Hu", "Q EQ", "linear P Hu", "linear P EQ"]
(pair_table(pd.DataFrame(rows, columns=columns), {"parameter": 6, **{c: 4 for c in columns[2:]}})
 .tab_header("Exercises 276 to 278: proportional hazard and Wang, calibrated to the CCoC premium",
             "Parameter calibrated here; P is premium, Q is capital; lifted unless marked linear"))
```


<style>
#vgyaiwpcnf table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#vgyaiwpcnf thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#vgyaiwpcnf p { margin: 0; padding: 0; }
 #vgyaiwpcnf .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #vgyaiwpcnf .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #vgyaiwpcnf .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #vgyaiwpcnf .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #vgyaiwpcnf .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #vgyaiwpcnf .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #vgyaiwpcnf .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #vgyaiwpcnf .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #vgyaiwpcnf .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #vgyaiwpcnf .gt_column_spanner_outer:first-child { padding-left: 0; }
 #vgyaiwpcnf .gt_column_spanner_outer:last-child { padding-right: 0; }
 #vgyaiwpcnf .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #vgyaiwpcnf .gt_spanner_row { border-bottom-style: hidden; }
 #vgyaiwpcnf .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #vgyaiwpcnf .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #vgyaiwpcnf .gt_from_md> :first-child { margin-top: 0; }
 #vgyaiwpcnf .gt_from_md> :last-child { margin-bottom: 0; }
 #vgyaiwpcnf .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #vgyaiwpcnf .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #vgyaiwpcnf .gt_indent_1 { text-indent: 5px; }
 #vgyaiwpcnf .gt_indent_2 { text-indent: calc(5px * 2); }
 #vgyaiwpcnf .gt_indent_3 { text-indent: calc(5px * 3); }
 #vgyaiwpcnf .gt_indent_4 { text-indent: calc(5px * 4); }
 #vgyaiwpcnf .gt_indent_5 { text-indent: calc(5px * 5); }
 #vgyaiwpcnf .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #vgyaiwpcnf .gt_row_group_first td { border-top-width: 2px; }
 #vgyaiwpcnf .gt_row_group_first th { border-top-width: 2px; }
 #vgyaiwpcnf .gt_striped { color: #333333; background-color: #F4F4F4; }
 #vgyaiwpcnf .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #vgyaiwpcnf .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #vgyaiwpcnf .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #vgyaiwpcnf .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #vgyaiwpcnf .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #vgyaiwpcnf .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #vgyaiwpcnf .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #vgyaiwpcnf .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #vgyaiwpcnf .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #vgyaiwpcnf .gt_left { text-align: left; }
 #vgyaiwpcnf .gt_center { text-align: center; }
 #vgyaiwpcnf .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #vgyaiwpcnf .gt_font_normal { font-weight: normal; }
 #vgyaiwpcnf .gt_font_bold { font-weight: bold; }
 #vgyaiwpcnf .gt_font_italic { font-style: italic; }
 #vgyaiwpcnf .gt_super { font-size: 65%; }
 #vgyaiwpcnf .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #vgyaiwpcnf .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #vgyaiwpcnf .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #vgyaiwpcnf .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #vgyaiwpcnf .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #vgyaiwpcnf .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="8" id="title" class="gt_heading gt_title gt_font_normal">Exercises 276 to 278: proportional hazard and Wang, calibrated to the CCoC premium</th>
</tr>
<tr class="gt_heading">
<th colspan="8" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Parameter calibrated here; P is premium, Q is capital; lifted unless marked linear</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="parameter" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">parameter</th>
<th id="P-Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">P Hu</th>
<th id="P-EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">P EQ</th>
<th id="Q-Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Q Hu</th>
<th id="Q-EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Q EQ</th>
<th id="linear-P-Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">linear P Hu</th>
<th id="linear-P-EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">linear P EQ</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">ph</th>
<td class="gt_row gt_right" headers="stub-1 parameter">0.821554</td>
<td class="gt_row gt_right" headers="stub-1 P-Hu">23.3342</td>
<td class="gt_row gt_right" headers="stub-1 P-EQ">7.4020</td>
<td class="gt_row gt_right" headers="stub-1 Q-Hu">40.0416</td>
<td class="gt_row gt_right" headers="stub-1 Q-EQ">29.2223</td>
<td class="gt_row gt_right" headers="stub-1 linear-P-Hu">23.0517</td>
<td class="gt_row gt_right" headers="stub-1 linear-P-EQ">7.6844</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">ph, book</th>
<td class="gt_row gt_right" headers="stub-2 parameter">0.82156</td>
<td class="gt_row gt_right" headers="stub-2 P-Hu">23.3342</td>
<td class="gt_row gt_right" headers="stub-2 P-EQ">7.402</td>
<td class="gt_row gt_right" headers="stub-2 Q-Hu">40.0416</td>
<td class="gt_row gt_right" headers="stub-2 Q-EQ">29.2223</td>
<td class="gt_row gt_right" headers="stub-2 linear-P-Hu">23.0517</td>
<td class="gt_row gt_right" headers="stub-2 linear-P-EQ">7.6844</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">wang</th>
<td class="gt_row gt_right" headers="stub-3 parameter">0.209615</td>
<td class="gt_row gt_right" headers="stub-3 P-Hu">24.0282</td>
<td class="gt_row gt_right" headers="stub-3 P-EQ">6.7082</td>
<td class="gt_row gt_right" headers="stub-3 Q-Hu">46.8427</td>
<td class="gt_row gt_right" headers="stub-3 Q-EQ">22.4209</td>
<td class="gt_row gt_right" headers="stub-3 linear-P-Hu">23.9277</td>
<td class="gt_row gt_right" headers="stub-3 linear-P-EQ">6.8087</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">wang, book</th>
<td class="gt_row gt_right" headers="stub-4 parameter">0.209615</td>
<td class="gt_row gt_right" headers="stub-4 P-Hu">24.0282</td>
<td class="gt_row gt_right" headers="stub-4 P-EQ">6.7082</td>
<td class="gt_row gt_right" headers="stub-4 Q-Hu">46.8427</td>
<td class="gt_row gt_right" headers="stub-4 Q-EQ">22.4209</td>
<td class="gt_row gt_right" headers="stub-4 linear-P-Hu">23.9277</td>
<td class="gt_row gt_right" headers="stub-4 linear-P-EQ">6.8087</td>
</tr>
</tbody>
</table>


All values match to the fourth decimal, except the PH parameter in its sixth digit. At the printed 0.82156 the total premium is 30.7361, the PH total the book prints, so the book calibrated slightly off 30.7364 or rounded 0.821554 up.


## The summary table

Table 15.31 compares five methods. Two are classical: the expected value premium (proportional to the limited expected loss) and the variance-covariance premium (expected loss plus the margin split by each unit's covariance with the total). The book uses the covariances of the **unlimited** losses, which `capital(..., "covariance")` on the uncapped outcomes gives:


``` python
premium, margin = 30.7364, 30.7364 - 23.81
expected_value = [premium * e / sum(el) for e in el]
uncapped = PredictiveDistribution(["unit"], [("Hu",), ("EQ",)],
                                  [[0.0, 0.0]] * 76 + [[99.0, 0.0]] * 19 + [[0.0, 100.0]] * 4 + [[99.0, 100.0]])
cov = capital(uncapped, ccoc, "covariance")
var_cov = [e + margin * c / cov.total for e, c in zip(el, cov.allocated)]
TABLE_1531 = [
    ("expected value", expected_value, (24.9241, 5.8123)),
    ("variance/covariance", var_cov, (24.6236, 6.1128)),
    ("Bodoff PLC", plc_premium, (24.8729, 5.8635)),
    ("lifted natural", [u.premium for u in lifted.allocated], (22.0749, 8.6615)),
    ("linear natural", [u.premium for u in linear.allocated], (18.4568, 12.2796)),
]
rows = []
for name, got, book in TABLE_1531:
    rows.append((name, *got, el[0] / got[0], el[1] / got[1]))
    rows.append((f"{name}, book", *book, NAN, NAN))
(pair_table(pd.DataFrame(rows, columns=["method", "Hu", "EQ", "LR Hu", "LR EQ"]),
            {"Hu": 4, "EQ": 4, "LR Hu": 3, "LR EQ": 3})
 .tab_header("Table 15.31: premium and loss ratio by unit and method",
             "Premium in currency units; loss ratio on the limited loss"))
```


<style>
#snfcimhkhv table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#snfcimhkhv thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#snfcimhkhv p { margin: 0; padding: 0; }
 #snfcimhkhv .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #snfcimhkhv .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #snfcimhkhv .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #snfcimhkhv .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #snfcimhkhv .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #snfcimhkhv .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #snfcimhkhv .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #snfcimhkhv .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #snfcimhkhv .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #snfcimhkhv .gt_column_spanner_outer:first-child { padding-left: 0; }
 #snfcimhkhv .gt_column_spanner_outer:last-child { padding-right: 0; }
 #snfcimhkhv .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #snfcimhkhv .gt_spanner_row { border-bottom-style: hidden; }
 #snfcimhkhv .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #snfcimhkhv .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #snfcimhkhv .gt_from_md> :first-child { margin-top: 0; }
 #snfcimhkhv .gt_from_md> :last-child { margin-bottom: 0; }
 #snfcimhkhv .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #snfcimhkhv .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #snfcimhkhv .gt_indent_1 { text-indent: 5px; }
 #snfcimhkhv .gt_indent_2 { text-indent: calc(5px * 2); }
 #snfcimhkhv .gt_indent_3 { text-indent: calc(5px * 3); }
 #snfcimhkhv .gt_indent_4 { text-indent: calc(5px * 4); }
 #snfcimhkhv .gt_indent_5 { text-indent: calc(5px * 5); }
 #snfcimhkhv .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #snfcimhkhv .gt_row_group_first td { border-top-width: 2px; }
 #snfcimhkhv .gt_row_group_first th { border-top-width: 2px; }
 #snfcimhkhv .gt_striped { color: #333333; background-color: #F4F4F4; }
 #snfcimhkhv .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #snfcimhkhv .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #snfcimhkhv .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #snfcimhkhv .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #snfcimhkhv .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #snfcimhkhv .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #snfcimhkhv .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #snfcimhkhv .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #snfcimhkhv .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #snfcimhkhv .gt_left { text-align: left; }
 #snfcimhkhv .gt_center { text-align: center; }
 #snfcimhkhv .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #snfcimhkhv .gt_font_normal { font-weight: normal; }
 #snfcimhkhv .gt_font_bold { font-weight: bold; }
 #snfcimhkhv .gt_font_italic { font-style: italic; }
 #snfcimhkhv .gt_super { font-size: 65%; }
 #snfcimhkhv .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #snfcimhkhv .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #snfcimhkhv .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #snfcimhkhv .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #snfcimhkhv .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #snfcimhkhv .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="5" id="title" class="gt_heading gt_title gt_font_normal">Table 15.31: premium and loss ratio by unit and method</th>
</tr>
<tr class="gt_heading">
<th colspan="5" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Premium in currency units; loss ratio on the limited loss</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Hu</th>
<th id="EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">EQ</th>
<th id="LR-Hu" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">LR Hu</th>
<th id="LR-EQ" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">LR EQ</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">expected value</th>
<td class="gt_row gt_right" headers="stub-1 Hu">24.9241</td>
<td class="gt_row gt_right" headers="stub-1 EQ">5.8123</td>
<td class="gt_row gt_right" headers="stub-1 LR-Hu">0.775</td>
<td class="gt_row gt_right" headers="stub-1 LR-EQ">0.775</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">expected value, book</th>
<td class="gt_row gt_right" headers="stub-2 Hu">24.9241</td>
<td class="gt_row gt_right" headers="stub-2 EQ">5.8123</td>
<td class="gt_row gt_right" headers="stub-2 LR-Hu"></td>
<td class="gt_row gt_right" headers="stub-2 LR-EQ"></td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">variance/covariance</th>
<td class="gt_row gt_right" headers="stub-3 Hu">24.6236</td>
<td class="gt_row gt_right" headers="stub-3 EQ">6.1128</td>
<td class="gt_row gt_right" headers="stub-3 LR-Hu">0.784</td>
<td class="gt_row gt_right" headers="stub-3 LR-EQ">0.737</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">variance/covariance, book</th>
<td class="gt_row gt_right" headers="stub-4 Hu">24.6236</td>
<td class="gt_row gt_right" headers="stub-4 EQ">6.1128</td>
<td class="gt_row gt_right" headers="stub-4 LR-Hu"></td>
<td class="gt_row gt_right" headers="stub-4 LR-EQ"></td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">Bodoff PLC</th>
<td class="gt_row gt_right" headers="stub-5 Hu">24.8729</td>
<td class="gt_row gt_right" headers="stub-5 EQ">5.8635</td>
<td class="gt_row gt_right" headers="stub-5 LR-Hu">0.776</td>
<td class="gt_row gt_right" headers="stub-5 LR-EQ">0.768</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">Bodoff PLC, book</th>
<td class="gt_row gt_right" headers="stub-6 Hu">24.8729</td>
<td class="gt_row gt_right" headers="stub-6 EQ">5.8635</td>
<td class="gt_row gt_right" headers="stub-6 LR-Hu"></td>
<td class="gt_row gt_right" headers="stub-6 LR-EQ"></td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">lifted natural</th>
<td class="gt_row gt_right" headers="stub-7 Hu">22.0749</td>
<td class="gt_row gt_right" headers="stub-7 EQ">8.6615</td>
<td class="gt_row gt_right" headers="stub-7 LR-Hu">0.875</td>
<td class="gt_row gt_right" headers="stub-7 LR-EQ">0.520</td>
</tr>
<tr>
<th id="stub-8" class="gt_row gt_left gt_stub" scope="row">lifted natural, book</th>
<td class="gt_row gt_right" headers="stub-8 Hu">22.0749</td>
<td class="gt_row gt_right" headers="stub-8 EQ">8.6615</td>
<td class="gt_row gt_right" headers="stub-8 LR-Hu"></td>
<td class="gt_row gt_right" headers="stub-8 LR-EQ"></td>
</tr>
<tr>
<th id="stub-9" class="gt_row gt_left gt_stub" scope="row">linear natural</th>
<td class="gt_row gt_right" headers="stub-9 Hu">18.4568</td>
<td class="gt_row gt_right" headers="stub-9 EQ">12.2796</td>
<td class="gt_row gt_right" headers="stub-9 LR-Hu">1.046</td>
<td class="gt_row gt_right" headers="stub-9 LR-EQ">0.367</td>
</tr>
<tr>
<th id="stub-10" class="gt_row gt_left gt_stub" scope="row">linear natural, book</th>
<td class="gt_row gt_right" headers="stub-10 Hu">18.4568</td>
<td class="gt_row gt_right" headers="stub-10 EQ">12.2796</td>
<td class="gt_row gt_right" headers="stub-10 LR-Hu"></td>
<td class="gt_row gt_right" headers="stub-10 LR-EQ"></td>
</tr>
</tbody>
</table>


The expected value, covariance and PLC premiums give the two perils almost the same loss ratio. The lifted allocation charges the rarer, more volatile earthquake a loss ratio of 0.52, and the cap misleads the linear allocation. The book prefers the lifted allocation but says no single answer is correct.


``` python
import numpy as np

methods = [name for name, _, _ in TABLE_1531]
x = np.arange(len(methods))
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9.0, 3.8))
for ax, values, ylabel, title in (
    (ax1, [got for _, got, _ in TABLE_1531], "premium", "Premium by unit"),
    (ax2, [(el[0] / got[0], el[1] / got[1]) for _, got, _ in TABLE_1531], "loss ratio on the limited loss",
     "Loss ratio by unit"),
):
    ax.bar(x - 0.2, [v[0] for v in values], width=0.4, label="Hu")
    ax.bar(x + 0.2, [v[1] for v in values], width=0.4, label="EQ")
    ax.set_xticks(x)
    ax.set_xticklabels(methods, rotation=40, ha="right")
    ax.set_ylabel(ylabel)
    ax.set_title(title)
ax1.legend()
fig.tight_layout()
```


<figure class="p-figure figure">
3aWR0aDogMC44OyBzdHJva2UtbGluZWNhcDogc3F1YXJlIiAvPgogICAgIDwvZz4KICAgICA8ZyBpZD0ibGluZTJkXzI4Ij4KICAgICAgPGc+CiAgICAgICA8dXNlIGhyZWY9IiNtM2U5Y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QgeD0iMzY1LjUwNzQyNiIgeT0iMjIuMzE4MTI1IiB3aWR0aD0iMjYwLjI4NTUwMiIgaGVpZ2h0PSIxNDYuOTgyNzE4IiAvPgogIDwvY2xpcHBhdGg+CiA8L2RlZnM+Cjwvc3ZnPg==" />
</figure>


# 7. Pricing bounds, and stand-alone against diversified

The natural allocation depends on the distortion. [Portfolio.premium_bounds](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.premium_bounds) gives each unit's lowest and highest premium under the linear allocation over **every** distortion that prices the capped total at the same premium. The extremes are BiTVaRs, found exactly (section 11.2.3 and Remark 262):


``` python
for row in bodoff_book.premium_bounds(30.7364, assets=100):
    print(f"{row['unit']}: {row['lower']:.4f} to {row['upper']:.4f}")
```


    Hu: 18.4568 to 24.9241
    EQ: 5.8123 to 12.2796


The earthquake premium can be anything from 5.81 (the expected value premium) to 12.28 (the linear CCoC premium, itself an extreme because it puts all its extra weight on the worst outcome). Every method in the summary table is in the range. A split outside it cannot come from a spectral risk measure that prices the book at 30.7364.

The diversification benefit: each unit priced alone at its own capital standard, against the book as one portfolio. [Portfolio.price_stand_alone](../reference/pricing.Portfolio.md#prospicio.pricing.Portfolio.price_stand_alone) uses a VaR standard:


``` python
alone = bodoff_book.price_stand_alone(ccoc, 0.99)
rows = [(f"{name} alone", u.assets, u.premium) for name, u in zip(alone.units, alone.stand_alone)]
rows += [("sum of the parts", alone.sum.assets, alone.sum.premium), ("together", alone.total.assets, alone.total.premium)]
(GT(pd.DataFrame(rows, columns=["case", "assets", "premium"]), rowname_col="case")
 .tab_header("Hurricane and earthquake priced alone and together", "CCoC 10%, VaR 99% standard; currency units")
 .fmt_number("assets", decimals=0, use_seps=False)
 .fmt_number("premium", decimals=4, use_seps=False))
```


<style>
#ywnynvqfrh table {
          font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', 'Fira Sans', 'Droid Sans', Arial, sans-serif;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
        }

#ywnynvqfrh thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#ywnynvqfrh p { margin: 0; padding: 0; }
 #ywnynvqfrh .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }
 #ywnynvqfrh .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #ywnynvqfrh .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }
 #ywnynvqfrh .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }
 #ywnynvqfrh .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #ywnynvqfrh .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #ywnynvqfrh .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }
 #ywnynvqfrh .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }
 #ywnynvqfrh .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }
 #ywnynvqfrh .gt_column_spanner_outer:first-child { padding-left: 0; }
 #ywnynvqfrh .gt_column_spanner_outer:last-child { padding-right: 0; }
 #ywnynvqfrh .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }
 #ywnynvqfrh .gt_spanner_row { border-bottom-style: hidden; }
 #ywnynvqfrh .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }
 #ywnynvqfrh .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }
 #ywnynvqfrh .gt_from_md> :first-child { margin-top: 0; }
 #ywnynvqfrh .gt_from_md> :last-child { margin-bottom: 0; }
 #ywnynvqfrh .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }
 #ywnynvqfrh .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }
 #ywnynvqfrh .gt_indent_1 { text-indent: 5px; }
 #ywnynvqfrh .gt_indent_2 { text-indent: calc(5px * 2); }
 #ywnynvqfrh .gt_indent_3 { text-indent: calc(5px * 3); }
 #ywnynvqfrh .gt_indent_4 { text-indent: calc(5px * 4); }
 #ywnynvqfrh .gt_indent_5 { text-indent: calc(5px * 5); }
 #ywnynvqfrh .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }
 #ywnynvqfrh .gt_row_group_first td { border-top-width: 2px; }
 #ywnynvqfrh .gt_row_group_first th { border-top-width: 2px; }
 #ywnynvqfrh .gt_striped { color: #333333; background-color: #F4F4F4; }
 #ywnynvqfrh .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #ywnynvqfrh .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #ywnynvqfrh .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #ywnynvqfrh .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #ywnynvqfrh .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #ywnynvqfrh .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #ywnynvqfrh .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #ywnynvqfrh .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #ywnynvqfrh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #ywnynvqfrh .gt_left { text-align: left; }
 #ywnynvqfrh .gt_center { text-align: center; }
 #ywnynvqfrh .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #ywnynvqfrh .gt_font_normal { font-weight: normal; }
 #ywnynvqfrh .gt_font_bold { font-weight: bold; }
 #ywnynvqfrh .gt_font_italic { font-style: italic; }
 #ywnynvqfrh .gt_super { font-size: 65%; }
 #ywnynvqfrh .gt_footnotes { color: font-color(#FFFFFF); background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #ywnynvqfrh .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #ywnynvqfrh .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }
 #ywnynvqfrh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #ywnynvqfrh .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #ywnynvqfrh .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" aria-describedby="subtitle" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="3" id="title" class="gt_heading gt_title gt_font_normal">Hurricane and earthquake priced alone and together</th>
</tr>
<tr class="gt_heading">
<th colspan="3" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">CCoC 10%, VaR 99% standard; currency units</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="assets" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">assets</th>
<th id="premium" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">premium</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">Hu alone</th>
<td class="gt_row gt_right" headers="stub-1 assets">99</td>
<td class="gt_row gt_right" headers="stub-1 premium">27.0000</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">EQ alone</th>
<td class="gt_row gt_right" headers="stub-2 assets">100</td>
<td class="gt_row gt_right" headers="stub-2 premium">13.6364</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">sum of the parts</th>
<td class="gt_row gt_right" headers="stub-3 assets">199</td>
<td class="gt_row gt_right" headers="stub-3 premium">40.6364</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">together</th>
<td class="gt_row gt_right" headers="stub-4 assets">100</td>
<td class="gt_row gt_right" headers="stub-4 premium">30.7364</td>
</tr>
</tbody>
</table>


Alone, each peril needs almost a full limit of assets. Together, assets of 100 support both and the premium falls from 40.64 to 30.74. The natural allocation shares that saving between the units.

Next: [Price allocation in practice](pir-price-allocation-practice.md) for the case studies and the reinsurance evaluation, and [Risk loads and distortions](risk-loads-and-distortions.md) for how to select a distortion.
