# Reserving methods: which one when


# Use this guide when

You have a loss triangle and must select a reserving method in prospicio. Which method answers your question with the data that you have? Typical questions:

- a best estimate for the balance sheet
- a standard error
- a full distribution, for capital or to price a cover on the reserve
- a one-year view, for a solvency standard

Terms:

- The **origin** (accident year) is the year in which the losses occurred.
- The **development age** is the number of months from the start of the origin year. Age 12 on accident year 2021 is the valuation date December 2021.
- A **triangle** holds one cumulative value for each origin and age. You observe only the upper-left part.
- The **reserve** is the **ultimate** (the final cost of the origin) minus the amount paid to date.
- A **link ratio** is the growth of an origin from one age to the next. An **age-to-age factor** is an average of the link ratios across origins. A **tail factor** gives the development after the oldest age.
- An **increment** is the amount paid in one cell.
- **Bornhuetter-Ferguson (BF)**, **Benktander** and **Cape Cod** mix the data with an **a priori**: an expected loss ratio that you set before you look at the triangle.
- **Over-dispersed Poisson (ODP)**: the variance of each increment is a scale times its mean. **CV**: standard error over mean.
- **Claims development result (CDR)**: the opening ultimate minus the ultimate one year later. Positive is favourable, negative is adverse.
- **NUTS** samples a Bayesian posterior. **R-hat** is its convergence check (a value near 1 is good).


# Start here

1.  **Best estimate.** Check the data (section 1). Run the chain ladder. For young origins with small paid amounts, compare it with BF or Cape Cod (section 4).
2.  **Uncertainty.** For a standard error, use Mack (section 3). For a quantile, a cover or capital, use a bootstrap (section 6).
3.  **Horizon.** Run-off to the last payment is the lifetime view. The next year only, as a solvency standard asks, is the one-year view (section 7).


# The decision table

| Situation | Method | prospicio call | Why |
|----|----|----|----|
| Mature book, stable pattern, you need a best estimate | Chain ladder | [ChainLadder()](../reference/reserving.ChainLadder.md#prospicio.reserving.ChainLadder) | Uses only the triangle. Assumes that the pattern is stable |
| You also need a standard error, with no distribution assumed | Mack | [Mack()](../reference/reserving.Mack.md#prospicio.reserving.Mack) | Chain ladder plus Mack's formula, split into process and parameter risk |
| Young origins whose few payments give little information | Bornhuetter-Ferguson | `BornhuetterFerguson(apriori)` | Reserves only the share of a prior that is still to develop |
| A plan loss ratio exists, but you want the data to have more weight | Benktander | `Benktander(apriori, n_iters=2)` | Repeats Bornhuetter-Ferguson and moves toward the chain ladder |
| No plan loss ratio that you trust, but you have premium | Cape Cod | `CapeCod(trend, decay)` | Estimates the loss ratio from the triangle |
| An origin with no paid amount yet | Expected loss | `ExpectedLoss(apriori)` | The prior alone, ignores the data |
| Few ages, you need a smooth pattern to compare with the chain ladder | Clark growth curve | `ClarkLdf(curve, max_age)`, [ClarkCapeCod](../reference/reserving.ClarkCapeCod.md#prospicio.reserving.ClarkCapeCod) | One curve for all cells. Set [max_age](../reference/reserving.Triangle.md#prospicio.reserving.Triangle.max_age) where development stops |
| Development continues after the oldest age | Tail factor | `tail=` on [ChainLadder](../reference/reserving.ChainLadder.md#prospicio.reserving.ChainLadder), [Mack](../reference/reserving.Mack.md#prospicio.reserving.Mack), the expected-loss methods and the two bootstraps | A constant, or a curve fitted to the factors |
| A distribution of the reserve, ODP assumptions | ODP bootstrap | `OdpBootstrap().fit` | Resamples residuals, draws gamma process error |
| A distribution that agrees with the standard error of Mack | Mack bootstrap | `MackBootstrap().fit` | Same variance structure as Mack, simulated |
| A posterior with a prior on the development or origin effects | Bayesian ODP | `BayesOdp().fit` | Posterior predictive reserve by NUTS |
| Premium, 10 or more years, positive cells, a prior on the loss ratio | Meyers CRC or CSR | `Meyers(model).fit` | Log-normal ultimates with a prior on the loss ratio |
| One-year risk of the chain ladder, no simulation | Merz-Wuthrich | `Mack().fit(...).claims_development_result()` | Closed form. Volume-weighted factors, no tail, one segment |
| One-year risk of chain ladder, BF, Benktander, Cape Cod or expected loss, with a tail or another grain | Simulated one-year view | `MackBootstrap().one_year`, `OdpBootstrap().one_year` | Re-reserves each simulation |
| Several lines, capital for the total | Dependence between lines | `dependence=` (and `spearman=`) on the two bootstraps | Keeps the joint behaviour of the lines |
| Check a method on your own history | Diagonal backtest | the loop in section 9 | Refit without the newest diagonal, forecast it |
| Reinsurance on the reserve (ADC, LPT) | Aggregate cover | [Tower.apply_aggregate](../reference/reinsurance.Tower.md#prospicio.reinsurance.Tower.apply_aggregate) | Applies a layer to each simulated total |


# 1. The data, and the rules about ages and exposure

The example is a synthetic paid triangle: seven accident years, annual ages 12 to 84 months and an earned premium for each origin. Money is in thousands of a synthetic currency.


``` python
from prospicio.reserving import (
    BayesOdp, Benktander, BornhuetterFerguson, CapeCod, ChainLadder, ClarkCapeCod,
    ClarkLdf, ExpectedLoss, Mack, MackBootstrap, Meyers, OdpBootstrap,
    TailBondy, TailConstant, TailCurve, TailLogLinear, Triangle,
)

paid = [  # cumulative paid by accident year, one row per year, ages 12, 24, ... months
    [203, 374, 508, 583, 644, 656, 667],
    [232, 432, 555, 659, 711, 754],
    [219, 407, 550, 664, 720],
    [246, 434, 601, 678],
    [267, 470, 632],
    [305, 539],
    [323],
]
premium = [1000, 1050, 1100, 1160, 1220, 1280, 1350]  # earned premium by accident year
years = list(range(2018, 2025))

origin = [y for y, row in zip(years, paid) for _ in row]
age = [12 * (k + 1) for row in paid for k in range(len(row))]
tri = Triangle.from_long(
    origin,
    age,
    {
        "paid": [v for row in paid for v in row],
        "premium": [premium[i] for i, row in enumerate(paid) for _ in row],
    },
)
print(tri.origins[0], "to", tri.origins[-1], "| ages", tri.development, "| valued", tri.valuation)
print(tri)
```


    2018 to 2024 | ages [12, 24, 36, 48, 60, 72, 84] | valued 2024-12-31
    Triangle: 1 segment x 2 columns (cumulative, valuation 2024-12)
    column   n_origins  first_origin  last_origin  valuation  latest
    paid             7          2018         2024    2024-12   4,313
    premium          7          2018         2024    2024-12   8,160


[Triangle.from_long](../reference/reserving.Triangle.md#prospicio.reserving.Triangle.from_long) takes one row for each origin and age. Rules:

- **Ages are months.** Annual data has ages 12, 24, 36. A quarterly triangle has ages 3, 6, 9 and needs `development_grain="Q"`. If your data gives the valuation date of each cell, use `development_is_valuation=True`.
- **Cumulative is the default.** Use `cumulative=False` for incremental payments. An unobserved cell is `nan`. An observed zero stays zero.
- **A segment is a key.** `keys={"line": [...]}` holds several lines in one triangle. Each fit then runs on each segment separately.

For data in a pandas frame, `Triangle.from_frame(df, origin="year", development="age", columns=["paid", "premium"], keys="line")` does the same.

**Exposure columns.** Bornhuetter-Ferguson, Benktander, Cape Cod, expected loss and Clark's Cape Cod take a second column name, the exposure (for example premium): `fit(tri, "paid", "premium")`. The library reads the **latest observed cumulative value** of that column for each origin. For a cumulative triangle, repeat the premium on each cell of the origin, as above. For an incremental triangle, the library adds the column over the ages: give the premium at the first age only and set the later cells to zero, or it counts the premium once for each age.


## Before you choose: check the data

Examine the link ratios, and compare paid with incurred.


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

lr = tri.link_ratios().to_long()
by_age = {}
for dev, f in zip(lr["development"], lr["paid"]):
    by_age.setdefault(dev, []).append(f)  # one ratio per origin, oldest first
cols = [str(y) for y in years]
ratios = pd.DataFrame(
    [fs + [float("nan")] * (6 - len(fs)) for fs in by_age.values()],
    index=[f"{dev} to {dev + 12}" for dev in by_age],
    columns=cols[:6],
).rename_axis("ages").reset_index()
(GT(ratios, rowname_col="ages")
 .tab_header("Link ratios of the paid triangle", "One column for each origin")
 .fmt_number(cols[:6], decimals=3)
 .sub_missing(missing_text=""))
```


<style>
#evrillxyxr 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;
        }

#evrillxyxr thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#evrillxyxr p { margin: 0; padding: 0; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #evrillxyxr .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; }
 #evrillxyxr .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; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #evrillxyxr .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; }
 #evrillxyxr .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; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_column_spanner_outer:first-child { padding-left: 0; }
 #evrillxyxr .gt_column_spanner_outer:last-child { padding-right: 0; }
 #evrillxyxr .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%; }
 #evrillxyxr .gt_spanner_row { border-bottom-style: hidden; }
 #evrillxyxr .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; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_from_md> :first-child { margin-top: 0; }
 #evrillxyxr .gt_from_md> :last-child { margin-bottom: 0; }
 #evrillxyxr .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; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_indent_1 { text-indent: 5px; }
 #evrillxyxr .gt_indent_2 { text-indent: calc(5px * 2); }
 #evrillxyxr .gt_indent_3 { text-indent: calc(5px * 3); }
 #evrillxyxr .gt_indent_4 { text-indent: calc(5px * 4); }
 #evrillxyxr .gt_indent_5 { text-indent: calc(5px * 5); }
 #evrillxyxr .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; }
 #evrillxyxr .gt_row_group_first td { border-top-width: 2px; }
 #evrillxyxr .gt_row_group_first th { border-top-width: 2px; }
 #evrillxyxr .gt_striped { color: #333333; background-color: #F4F4F4; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #evrillxyxr .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #evrillxyxr .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #evrillxyxr .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #evrillxyxr .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #evrillxyxr .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #evrillxyxr .gt_left { text-align: left; }
 #evrillxyxr .gt_center { text-align: center; }
 #evrillxyxr .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #evrillxyxr .gt_font_normal { font-weight: normal; }
 #evrillxyxr .gt_font_bold { font-weight: bold; }
 #evrillxyxr .gt_font_italic { font-style: italic; }
 #evrillxyxr .gt_super { font-size: 65%; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #evrillxyxr .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; }
 #evrillxyxr .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #evrillxyxr .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #evrillxyxr .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">Link ratios of the paid triangle</th>
</tr>
<tr class="gt_heading">
<th colspan="7" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">One column for each origin</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="2018" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2018</th>
<th id="2019" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2019</th>
<th id="2020" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2020</th>
<th id="2021" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2021</th>
<th id="2022" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2022</th>
<th id="2023" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2023</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">12 to 24</th>
<td class="gt_row gt_right" headers="stub-1 2018">1.842</td>
<td class="gt_row gt_right" headers="stub-1 2019">1.862</td>
<td class="gt_row gt_right" headers="stub-1 2020">1.858</td>
<td class="gt_row gt_right" headers="stub-1 2021">1.764</td>
<td class="gt_row gt_right" headers="stub-1 2022">1.760</td>
<td class="gt_row gt_right" headers="stub-1 2023">1.767</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">24 to 36</th>
<td class="gt_row gt_right" headers="stub-2 2018">1.358</td>
<td class="gt_row gt_right" headers="stub-2 2019">1.285</td>
<td class="gt_row gt_right" headers="stub-2 2020">1.351</td>
<td class="gt_row gt_right" headers="stub-2 2021">1.385</td>
<td class="gt_row gt_right" headers="stub-2 2022">1.345</td>
<td class="gt_row gt_right" headers="stub-2 2023"></td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">36 to 48</th>
<td class="gt_row gt_right" headers="stub-3 2018">1.148</td>
<td class="gt_row gt_right" headers="stub-3 2019">1.187</td>
<td class="gt_row gt_right" headers="stub-3 2020">1.207</td>
<td class="gt_row gt_right" headers="stub-3 2021">1.128</td>
<td class="gt_row gt_right" headers="stub-3 2022"></td>
<td class="gt_row gt_right" headers="stub-3 2023"></td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">48 to 60</th>
<td class="gt_row gt_right" headers="stub-4 2018">1.105</td>
<td class="gt_row gt_right" headers="stub-4 2019">1.079</td>
<td class="gt_row gt_right" headers="stub-4 2020">1.084</td>
<td class="gt_row gt_right" headers="stub-4 2021"></td>
<td class="gt_row gt_right" headers="stub-4 2022"></td>
<td class="gt_row gt_right" headers="stub-4 2023"></td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">60 to 72</th>
<td class="gt_row gt_right" headers="stub-5 2018">1.019</td>
<td class="gt_row gt_right" headers="stub-5 2019">1.060</td>
<td class="gt_row gt_right" headers="stub-5 2020"></td>
<td class="gt_row gt_right" headers="stub-5 2021"></td>
<td class="gt_row gt_right" headers="stub-5 2022"></td>
<td class="gt_row gt_right" headers="stub-5 2023"></td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">72 to 84</th>
<td class="gt_row gt_right" headers="stub-6 2018">1.017</td>
<td class="gt_row gt_right" headers="stub-6 2019"></td>
<td class="gt_row gt_right" headers="stub-6 2020"></td>
<td class="gt_row gt_right" headers="stub-6 2021"></td>
<td class="gt_row gt_right" headers="stub-6 2022"></td>
<td class="gt_row gt_right" headers="stub-6 2023"></td>
</tr>
</tbody>
</table>


No ratio is an outlier, but the three newest 12 to 24 ratios are below the three oldest. Faster reporting or a change in payment practice can cause this. The volume-weighted factor mixes the two regimes: find the cause before you accept either. The late factors each use one or two ratios; a tail or a benchmark helps there.

For an outlying link ratio, compare the three averages (section 2). If one large loss causes it, remove the loss from the triangle and reserve it separately.

**Paid or incurred.** Incurred (paid plus case reserves) develops faster, so it says more about young origins and long-tailed lines. But it also contains each change in how the claims department sets case reserves. Run the same calls on both columns. Here a synthetic incurred triangle has stable case reserving, or case reserves on the latest diagonal increased by 25%.


``` python
case = [0.80, 0.45, 0.25, 0.13, 0.06, 0.03, 0.015]  # case reserve over paid, by age

def incurred_triangle(strengthen):
    vals = [round(v * (1 + case[k] * (strengthen if k == len(row) - 1 else 1.0)))
            for row in paid for k, v in enumerate(row)]
    return Triangle.from_long(origin, age, {"incurred": vals})

def wide(rows, stub, columns):
    """One row for each key of rows (the stub), with the given columns."""
    return pd.DataFrame.from_dict(rows, orient="index", columns=columns).rename_axis(stub).reset_index()

ultimates = {}
for label, strengthen in [("paid", None), ("incurred", 1.0), ("incurred, case +25%", 1.25)]:
    if strengthen is None:
        fit = ChainLadder().fit(tri, "paid")
    else:
        fit = ChainLadder().fit(incurred_triangle(strengthen), "incurred")
    ultimates[label] = list(fit.ultimate) + [sum(fit.ultimate)]
(GT(wide(ultimates, "triangle", cols + ["total"]), rowname_col="triangle")
 .tab_header("Chain ladder ultimate by origin", "Thousands of a synthetic currency")
 .fmt_number(cols + ["total"], decimals=0))
```


<style>
#zvybafkiyl 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;
        }

#zvybafkiyl thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#zvybafkiyl p { margin: 0; padding: 0; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #zvybafkiyl .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; }
 #zvybafkiyl .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; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #zvybafkiyl .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; }
 #zvybafkiyl .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; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_column_spanner_outer:first-child { padding-left: 0; }
 #zvybafkiyl .gt_column_spanner_outer:last-child { padding-right: 0; }
 #zvybafkiyl .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%; }
 #zvybafkiyl .gt_spanner_row { border-bottom-style: hidden; }
 #zvybafkiyl .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; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_from_md> :first-child { margin-top: 0; }
 #zvybafkiyl .gt_from_md> :last-child { margin-bottom: 0; }
 #zvybafkiyl .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; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_indent_1 { text-indent: 5px; }
 #zvybafkiyl .gt_indent_2 { text-indent: calc(5px * 2); }
 #zvybafkiyl .gt_indent_3 { text-indent: calc(5px * 3); }
 #zvybafkiyl .gt_indent_4 { text-indent: calc(5px * 4); }
 #zvybafkiyl .gt_indent_5 { text-indent: calc(5px * 5); }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_row_group_first td { border-top-width: 2px; }
 #zvybafkiyl .gt_row_group_first th { border-top-width: 2px; }
 #zvybafkiyl .gt_striped { color: #333333; background-color: #F4F4F4; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #zvybafkiyl .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #zvybafkiyl .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #zvybafkiyl .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #zvybafkiyl .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #zvybafkiyl .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #zvybafkiyl .gt_left { text-align: left; }
 #zvybafkiyl .gt_center { text-align: center; }
 #zvybafkiyl .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #zvybafkiyl .gt_font_normal { font-weight: normal; }
 #zvybafkiyl .gt_font_bold { font-weight: bold; }
 #zvybafkiyl .gt_font_italic { font-style: italic; }
 #zvybafkiyl .gt_super { font-size: 65%; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #zvybafkiyl .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; }
 #zvybafkiyl .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #zvybafkiyl .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #zvybafkiyl .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="9" id="title" class="gt_heading gt_title gt_font_normal">Chain ladder ultimate by origin</th>
</tr>
<tr class="gt_heading">
<th colspan="9" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="2018" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2018</th>
<th id="2019" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2019</th>
<th id="2020" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2020</th>
<th id="2021" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2021</th>
<th id="2022" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2022</th>
<th id="2023" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2023</th>
<th id="2024" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2024</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">paid</th>
<td class="gt_row gt_right" headers="stub-1 2018">667</td>
<td class="gt_row gt_right" headers="stub-1 2019">767</td>
<td class="gt_row gt_right" headers="stub-1 2020">762</td>
<td class="gt_row gt_right" headers="stub-1 2021">781</td>
<td class="gt_row gt_right" headers="stub-1 2022">850</td>
<td class="gt_row gt_right" headers="stub-1 2023">974</td>
<td class="gt_row gt_right" headers="stub-1 2024">1,053</td>
<td class="gt_row gt_right" headers="stub-1 total">5,853</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">incurred</th>
<td class="gt_row gt_right" headers="stub-2 2018">677</td>
<td class="gt_row gt_right" headers="stub-2 2019">778</td>
<td class="gt_row gt_right" headers="stub-2 2020">773</td>
<td class="gt_row gt_right" headers="stub-2 2021">792</td>
<td class="gt_row gt_right" headers="stub-2 2022">862</td>
<td class="gt_row gt_right" headers="stub-2 2023">989</td>
<td class="gt_row gt_right" headers="stub-2 2024">1,068</td>
<td class="gt_row gt_right" headers="stub-2 total">5,939</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">incurred, case +25%</th>
<td class="gt_row gt_right" headers="stub-3 2018">680</td>
<td class="gt_row gt_right" headers="stub-3 2019">787</td>
<td class="gt_row gt_right" headers="stub-3 2020">790</td>
<td class="gt_row gt_right" headers="stub-3 2021">826</td>
<td class="gt_row gt_right" headers="stub-3 2022">924</td>
<td class="gt_row gt_right" headers="stub-3 2023">1,099</td>
<td class="gt_row gt_right" headers="stub-3 2024">1,245</td>
<td class="gt_row gt_right" headers="stub-3 total">6,350</td>
</tr>
</tbody>
</table>


With stable case reserving, the two agree within the case reserve still open at 84 months (5,939 against 5,853), so paid may need a tail. After the increase, the incurred chain ladder applies the old factors to the stronger cells, and the youngest ultimate rises from 1,068 to 1,245. The paid triangle does not show the change. When paid and incurred disagree like this, ask the claims department before you select either.


# 2. Chain ladder: the default

**What it is.** Each age-to-age factor is an average of the link ratios at that age. The product of the factors from the age of an origin to the end is its age-to-ultimate factor ([cdf](../reference/risk.Gpd.md#prospicio.risk.Gpd.cdf)). The ultimate is the latest value times it.

**Use it when** the book is mature and stable, payment patterns did not change, and each origin has a sufficient paid amount.

**Do not use it alone when** the youngest origins have small paid amounts. Their ultimate is the latest cell times the largest factor, so a noisy first cell goes directly into the reserve.

**Data it needs.** Only the triangle.


``` python
cl = ChainLadder().fit(tri, "paid")
n = len(years)
cl_rows = pd.DataFrame(
    {
        "age": [12 * (n - i) for i in range(n)] + [None],
        "next": [cl.ldf[n - 1 - i] if n - 1 - i < len(cl.ldf) else None for i in range(n)] + [None],
        "cdf": [cl.cdf[n - 1 - i] for i in range(n)] + [None],
        "ultimate": list(cl.ultimate) + [sum(cl.ultimate)],
        "reserve": list(cl.reserve) + [cl.total_reserve],
    },
    index=cols + ["total"],
).rename_axis("origin").reset_index()
(GT(cl_rows, rowname_col="origin")
 .tab_header("Chain ladder, volume-weighted", "Thousands of a synthetic currency")
 .cols_label(age="latest age", next="next factor", cdf="to ultimate")
 .fmt_integer("age")
 .fmt_number(["next", "cdf"], decimals=3)
 .fmt_number(["ultimate", "reserve"], decimals=0)
 .sub_missing(missing_text=""))
```


<style>
#nrpogqruyo 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;
        }

#nrpogqruyo thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#nrpogqruyo p { margin: 0; padding: 0; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #nrpogqruyo .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; }
 #nrpogqruyo .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; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #nrpogqruyo .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; }
 #nrpogqruyo .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; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_column_spanner_outer:first-child { padding-left: 0; }
 #nrpogqruyo .gt_column_spanner_outer:last-child { padding-right: 0; }
 #nrpogqruyo .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%; }
 #nrpogqruyo .gt_spanner_row { border-bottom-style: hidden; }
 #nrpogqruyo .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; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_from_md> :first-child { margin-top: 0; }
 #nrpogqruyo .gt_from_md> :last-child { margin-bottom: 0; }
 #nrpogqruyo .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; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_indent_1 { text-indent: 5px; }
 #nrpogqruyo .gt_indent_2 { text-indent: calc(5px * 2); }
 #nrpogqruyo .gt_indent_3 { text-indent: calc(5px * 3); }
 #nrpogqruyo .gt_indent_4 { text-indent: calc(5px * 4); }
 #nrpogqruyo .gt_indent_5 { text-indent: calc(5px * 5); }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_row_group_first td { border-top-width: 2px; }
 #nrpogqruyo .gt_row_group_first th { border-top-width: 2px; }
 #nrpogqruyo .gt_striped { color: #333333; background-color: #F4F4F4; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #nrpogqruyo .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #nrpogqruyo .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #nrpogqruyo .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #nrpogqruyo .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #nrpogqruyo .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #nrpogqruyo .gt_left { text-align: left; }
 #nrpogqruyo .gt_center { text-align: center; }
 #nrpogqruyo .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #nrpogqruyo .gt_font_normal { font-weight: normal; }
 #nrpogqruyo .gt_font_bold { font-weight: bold; }
 #nrpogqruyo .gt_font_italic { font-style: italic; }
 #nrpogqruyo .gt_super { font-size: 65%; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #nrpogqruyo .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; }
 #nrpogqruyo .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #nrpogqruyo .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #nrpogqruyo .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">Chain ladder, volume-weighted</th>
</tr>
<tr class="gt_heading">
<th colspan="6" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="age" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">latest age</th>
<th id="next" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">next factor</th>
<th id="cdf" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">to ultimate</th>
<th id="ultimate" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">ultimate</th>
<th id="reserve" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">reserve</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">2018</th>
<td class="gt_row gt_right" headers="stub-1 age">84</td>
<td class="gt_row gt_right" headers="stub-1 next"></td>
<td class="gt_row gt_right" headers="stub-1 cdf">1.000</td>
<td class="gt_row gt_right" headers="stub-1 ultimate">667</td>
<td class="gt_row gt_right" headers="stub-1 reserve">0</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">2019</th>
<td class="gt_row gt_right" headers="stub-2 age">72</td>
<td class="gt_row gt_right" headers="stub-2 next">1.017</td>
<td class="gt_row gt_right" headers="stub-2 cdf">1.017</td>
<td class="gt_row gt_right" headers="stub-2 ultimate">767</td>
<td class="gt_row gt_right" headers="stub-2 reserve">13</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">2020</th>
<td class="gt_row gt_right" headers="stub-3 age">60</td>
<td class="gt_row gt_right" headers="stub-3 next">1.041</td>
<td class="gt_row gt_right" headers="stub-3 cdf">1.058</td>
<td class="gt_row gt_right" headers="stub-3 ultimate">762</td>
<td class="gt_row gt_right" headers="stub-3 reserve">42</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">2021</th>
<td class="gt_row gt_right" headers="stub-4 age">48</td>
<td class="gt_row gt_right" headers="stub-4 next">1.089</td>
<td class="gt_row gt_right" headers="stub-4 cdf">1.152</td>
<td class="gt_row gt_right" headers="stub-4 ultimate">781</td>
<td class="gt_row gt_right" headers="stub-4 reserve">103</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">2022</th>
<td class="gt_row gt_right" headers="stub-5 age">36</td>
<td class="gt_row gt_right" headers="stub-5 next">1.167</td>
<td class="gt_row gt_right" headers="stub-5 cdf">1.344</td>
<td class="gt_row gt_right" headers="stub-5 ultimate">850</td>
<td class="gt_row gt_right" headers="stub-5 reserve">218</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">2023</th>
<td class="gt_row gt_right" headers="stub-6 age">24</td>
<td class="gt_row gt_right" headers="stub-6 next">1.344</td>
<td class="gt_row gt_right" headers="stub-6 cdf">1.807</td>
<td class="gt_row gt_right" headers="stub-6 ultimate">974</td>
<td class="gt_row gt_right" headers="stub-6 reserve">435</td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">2024</th>
<td class="gt_row gt_right" headers="stub-7 age">12</td>
<td class="gt_row gt_right" headers="stub-7 next">1.804</td>
<td class="gt_row gt_right" headers="stub-7 cdf">3.261</td>
<td class="gt_row gt_right" headers="stub-7 ultimate">1,053</td>
<td class="gt_row gt_right" headers="stub-7 reserve">730</td>
</tr>
<tr>
<th id="stub-8" class="gt_row gt_left gt_stub" scope="row">total</th>
<td class="gt_row gt_right" headers="stub-8 age"></td>
<td class="gt_row gt_right" headers="stub-8 next"></td>
<td class="gt_row gt_right" headers="stub-8 cdf"></td>
<td class="gt_row gt_right" headers="stub-8 ultimate">5,853</td>
<td class="gt_row gt_right" headers="stub-8 reserve">1,540</td>
</tr>
</tbody>
</table>


[average](../reference/reserving.Mack.md#prospicio.reserving.Mack.average) sets how the link ratios become a factor: `"volume"` (the default) weights by size, `"simple"` is the plain mean and `"regression"` is least squares through the origin.


``` python
for average in ["volume", "simple", "regression"]:
    print(average, round(ChainLadder(average=average).fit(tri, "paid").total_reserve, 1))
```


    volume 1540.4
    simple 1542.7
    regression 1538.0


The three differ by less than 5 in 1,540. They differ more when one origin has an outlying link ratio: then compare all three.

**Pitfalls.** The chain ladder assumes that the next diagonal develops like the last ones. A change in claims handling or case reserving makes this false, and the chain ladder does not show it. The diagonal backtest (section 9) can.


## Tail factors

The oldest age is 84 months and paid still grows (the last factor is more than 1). Without a tail, the model assumes that development stops. `tail=` adds development after the oldest age. [ChainLadder](../reference/reserving.ChainLadder.md#prospicio.reserving.ChainLadder), [Mack](../reference/reserving.Mack.md#prospicio.reserving.Mack), the expected-loss methods of section 4 and the two bootstraps take it. Clark uses [max_age](../reference/reserving.Triangle.md#prospicio.reserving.Triangle.max_age); the Bayesian models take no tail.

| Argument | What it does | Use it when |
|----|----|----|
| `tail=1.02` or `TailConstant(1.02)` | A given factor from the oldest age to ultimate | You have a benchmark |
| [TailCurve()](../reference/reserving.TailCurve.md#prospicio.reserving.TailCurve) | Regresses `ln(f - 1)` on the development index 1, 2, 3, … (`"exponential"`) or on its log (`"inverse_power"`), over the factors above 1, and extrapolates | The factors decay smoothly |
| [TailBondy()](../reference/reserving.TailBondy.md#prospicio.reserving.TailBondy) | Each log factor is a constant times the one before it. By default this repeats the last factor | A simple rule when you do not trust a curve |
| [TailLogLinear()](../reference/reserving.TailLogLinear.md#prospicio.reserving.TailLogLinear) | R ChainLadder's `tail = TRUE` rule | You must match an R `MackChainLadder(tail = TRUE)` |


``` python
tails = []
for name, tail in [
    ("none", None),
    ("TailConstant(1.02)", TailConstant(1.02)),
    ("TailCurve()", TailCurve()),
    ("TailBondy()", TailBondy()),
    ("TailLogLinear()", TailLogLinear()),
]:
    fit = ChainLadder(tail=tail).fit(tri, "paid")
    tails.append((name, fit.tail, fit.total_reserve))
(GT(pd.DataFrame(tails, columns=["rule", "tail", "reserve"]), rowname_col="rule")
 .tab_header("Chain ladder with a tail", "Thousands of a synthetic currency")
 .fmt_number("tail", decimals=4)
 .fmt_number("reserve", decimals=1))
```


<style>
#thrptoesen 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;
        }

#thrptoesen thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#thrptoesen p { margin: 0; padding: 0; }
 #thrptoesen .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; }
 #thrptoesen .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #thrptoesen .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; }
 #thrptoesen .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; }
 #thrptoesen .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; }
 #thrptoesen .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #thrptoesen .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; }
 #thrptoesen .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; }
 #thrptoesen .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; }
 #thrptoesen .gt_column_spanner_outer:first-child { padding-left: 0; }
 #thrptoesen .gt_column_spanner_outer:last-child { padding-right: 0; }
 #thrptoesen .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%; }
 #thrptoesen .gt_spanner_row { border-bottom-style: hidden; }
 #thrptoesen .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; }
 #thrptoesen .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; }
 #thrptoesen .gt_from_md> :first-child { margin-top: 0; }
 #thrptoesen .gt_from_md> :last-child { margin-bottom: 0; }
 #thrptoesen .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; }
 #thrptoesen .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; }
 #thrptoesen .gt_indent_1 { text-indent: 5px; }
 #thrptoesen .gt_indent_2 { text-indent: calc(5px * 2); }
 #thrptoesen .gt_indent_3 { text-indent: calc(5px * 3); }
 #thrptoesen .gt_indent_4 { text-indent: calc(5px * 4); }
 #thrptoesen .gt_indent_5 { text-indent: calc(5px * 5); }
 #thrptoesen .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; }
 #thrptoesen .gt_row_group_first td { border-top-width: 2px; }
 #thrptoesen .gt_row_group_first th { border-top-width: 2px; }
 #thrptoesen .gt_striped { color: #333333; background-color: #F4F4F4; }
 #thrptoesen .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; }
 #thrptoesen .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #thrptoesen .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #thrptoesen .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #thrptoesen .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #thrptoesen .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #thrptoesen .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #thrptoesen .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; }
 #thrptoesen .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #thrptoesen .gt_left { text-align: left; }
 #thrptoesen .gt_center { text-align: center; }
 #thrptoesen .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #thrptoesen .gt_font_normal { font-weight: normal; }
 #thrptoesen .gt_font_bold { font-weight: bold; }
 #thrptoesen .gt_font_italic { font-style: italic; }
 #thrptoesen .gt_super { font-size: 65%; }
 #thrptoesen .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; }
 #thrptoesen .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #thrptoesen .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; }
 #thrptoesen .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #thrptoesen .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #thrptoesen .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">Chain ladder with a tail</th>
</tr>
<tr class="gt_heading">
<th colspan="3" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="tail" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">tail</th>
<th id="reserve" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">reserve</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">none</th>
<td class="gt_row gt_right" headers="stub-1 tail">1.0000</td>
<td class="gt_row gt_right" headers="stub-1 reserve">1,540.4</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">TailConstant(1.02)</th>
<td class="gt_row gt_right" headers="stub-2 tail">1.0200</td>
<td class="gt_row gt_right" headers="stub-2 reserve">1,657.5</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">TailCurve()</th>
<td class="gt_row gt_right" headers="stub-3 tail">1.0161</td>
<td class="gt_row gt_right" headers="stub-3 reserve">1,634.5</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">TailBondy()</th>
<td class="gt_row gt_right" headers="stub-4 tail">1.0168</td>
<td class="gt_row gt_right" headers="stub-4 reserve">1,638.6</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">TailLogLinear()</th>
<td class="gt_row gt_right" headers="stub-5 tail">1.0161</td>
<td class="gt_row gt_right" headers="stub-5 reserve">1,634.5</td>
</tr>
</tbody>
</table>


[TailCurve()](../reference/reserving.TailCurve.md#prospicio.reserving.TailCurve) and [TailLogLinear()](../reference/reserving.TailLogLinear.md#prospicio.reserving.TailLogLinear) agree here because both regress `ln(f - 1)` on the development index. Their guards differ. [TailLogLinear](../reference/reserving.TailLogLinear.md#prospicio.reserving.TailLogLinear) is 1 unless the third-last and second-last factors multiply to more than 1.0001, and it resets a tail above 2 to 1, as R does. A tail adds 94 to 117, about 6% to 8% of the reserve, so a tail is always an important assumption.


# 3. Mack: the chain ladder with a standard error

**What it is.** Mack's distribution-free model has the chain ladder's reserve and adds its standard error, in two parts:

- **Process risk** is the randomness of the payments.
- **Parameter risk** is the error in the estimated factors.

**Use it when** a mean and a standard deviation are sufficient (a reserve range, a CV).

**Do not use it when** you need a quantile of the reserve. A standard error is not a distribution. For the 99.5% reserve, use a bootstrap (section 6).


``` python
mack = Mack().fit(tri, "paid")
tailed = Mack(tail=TailCurve()).fit(tri, "paid")
mack_rows = pd.DataFrame(
    {
        "reserve": list(mack.reserve) + [mack.total_reserve],
        "standard error": list(mack.standard_error) + [mack.total_standard_error],
    },
    index=cols + ["total"],
).rename_axis("origin").reset_index()
(GT(mack_rows, rowname_col="origin")
 .tab_header("Mack, no tail", "Thousands of a synthetic currency")
 .fmt_number(["reserve", "standard error"], decimals=1))
```


<style>
#yvwevgvkml 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;
        }

#yvwevgvkml thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#yvwevgvkml p { margin: 0; padding: 0; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #yvwevgvkml .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; }
 #yvwevgvkml .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; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #yvwevgvkml .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; }
 #yvwevgvkml .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; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_column_spanner_outer:first-child { padding-left: 0; }
 #yvwevgvkml .gt_column_spanner_outer:last-child { padding-right: 0; }
 #yvwevgvkml .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%; }
 #yvwevgvkml .gt_spanner_row { border-bottom-style: hidden; }
 #yvwevgvkml .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; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_from_md> :first-child { margin-top: 0; }
 #yvwevgvkml .gt_from_md> :last-child { margin-bottom: 0; }
 #yvwevgvkml .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; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_indent_1 { text-indent: 5px; }
 #yvwevgvkml .gt_indent_2 { text-indent: calc(5px * 2); }
 #yvwevgvkml .gt_indent_3 { text-indent: calc(5px * 3); }
 #yvwevgvkml .gt_indent_4 { text-indent: calc(5px * 4); }
 #yvwevgvkml .gt_indent_5 { text-indent: calc(5px * 5); }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_row_group_first td { border-top-width: 2px; }
 #yvwevgvkml .gt_row_group_first th { border-top-width: 2px; }
 #yvwevgvkml .gt_striped { color: #333333; background-color: #F4F4F4; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #yvwevgvkml .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #yvwevgvkml .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #yvwevgvkml .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #yvwevgvkml .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #yvwevgvkml .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #yvwevgvkml .gt_left { text-align: left; }
 #yvwevgvkml .gt_center { text-align: center; }
 #yvwevgvkml .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #yvwevgvkml .gt_font_normal { font-weight: normal; }
 #yvwevgvkml .gt_font_bold { font-weight: bold; }
 #yvwevgvkml .gt_font_italic { font-style: italic; }
 #yvwevgvkml .gt_super { font-size: 65%; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #yvwevgvkml .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; }
 #yvwevgvkml .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #yvwevgvkml .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #yvwevgvkml .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">Mack, no tail</th>
</tr>
<tr class="gt_heading">
<th colspan="3" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="reserve" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">reserve</th>
<th id="standard-error" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">standard error</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">2018</th>
<td class="gt_row gt_right" headers="stub-1 reserve">0.0</td>
<td class="gt_row gt_right" headers="stub-1 standard-error">0.0</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">2019</th>
<td class="gt_row gt_right" headers="stub-2 reserve">12.6</td>
<td class="gt_row gt_right" headers="stub-2 standard-error">20.8</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">2020</th>
<td class="gt_row gt_right" headers="stub-3 reserve">41.8</td>
<td class="gt_row gt_right" headers="stub-3 standard-error">33.2</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">2021</th>
<td class="gt_row gt_right" headers="stub-4 reserve">103.0</td>
<td class="gt_row gt_right" headers="stub-4 standard-error">35.5</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">2022</th>
<td class="gt_row gt_right" headers="stub-5 reserve">217.6</td>
<td class="gt_row gt_right" headers="stub-5 standard-error">47.1</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">2023</th>
<td class="gt_row gt_right" headers="stub-6 reserve">435.1</td>
<td class="gt_row gt_right" headers="stub-6 standard-error">58.2</td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">2024</th>
<td class="gt_row gt_right" headers="stub-7 reserve">730.3</td>
<td class="gt_row gt_right" headers="stub-7 standard-error">67.4</td>
</tr>
<tr>
<th id="stub-8" class="gt_row gt_left gt_stub" scope="row">total</th>
<td class="gt_row gt_right" headers="stub-8 reserve">1,540.4</td>
<td class="gt_row gt_right" headers="stub-8 standard-error">173.6</td>
</tr>
</tbody>
</table>


``` python
summary = {
    "no tail": mack,
    "fitted tail": tailed,
}
mack_totals = pd.DataFrame(
    [(k, m.total_reserve, m.total_standard_error, m.total_cv, m.total_process_risk, m.total_parameter_risk)
     for k, m in summary.items()],
    columns=["total", "reserve", "standard error", "cv", "process", "parameter"],
)
(GT(mack_totals, rowname_col="total")
 .tab_header("Mack, total reserve", "Thousands of a synthetic currency")
 .fmt_number(["reserve", "standard error", "process", "parameter"], decimals=1)
 .fmt_number("cv", decimals=3))
```


<style>
#pbzniajpxj 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;
        }

#pbzniajpxj thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#pbzniajpxj p { margin: 0; padding: 0; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #pbzniajpxj .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; }
 #pbzniajpxj .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; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #pbzniajpxj .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; }
 #pbzniajpxj .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; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_column_spanner_outer:first-child { padding-left: 0; }
 #pbzniajpxj .gt_column_spanner_outer:last-child { padding-right: 0; }
 #pbzniajpxj .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%; }
 #pbzniajpxj .gt_spanner_row { border-bottom-style: hidden; }
 #pbzniajpxj .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; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_from_md> :first-child { margin-top: 0; }
 #pbzniajpxj .gt_from_md> :last-child { margin-bottom: 0; }
 #pbzniajpxj .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; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_indent_1 { text-indent: 5px; }
 #pbzniajpxj .gt_indent_2 { text-indent: calc(5px * 2); }
 #pbzniajpxj .gt_indent_3 { text-indent: calc(5px * 3); }
 #pbzniajpxj .gt_indent_4 { text-indent: calc(5px * 4); }
 #pbzniajpxj .gt_indent_5 { text-indent: calc(5px * 5); }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_row_group_first td { border-top-width: 2px; }
 #pbzniajpxj .gt_row_group_first th { border-top-width: 2px; }
 #pbzniajpxj .gt_striped { color: #333333; background-color: #F4F4F4; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #pbzniajpxj .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #pbzniajpxj .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #pbzniajpxj .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #pbzniajpxj .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #pbzniajpxj .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #pbzniajpxj .gt_left { text-align: left; }
 #pbzniajpxj .gt_center { text-align: center; }
 #pbzniajpxj .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #pbzniajpxj .gt_font_normal { font-weight: normal; }
 #pbzniajpxj .gt_font_bold { font-weight: bold; }
 #pbzniajpxj .gt_font_italic { font-style: italic; }
 #pbzniajpxj .gt_super { font-size: 65%; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #pbzniajpxj .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; }
 #pbzniajpxj .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #pbzniajpxj .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #pbzniajpxj .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">Mack, total reserve</th>
</tr>
<tr class="gt_heading">
<th colspan="6" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="reserve" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">reserve</th>
<th id="standard-error" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">standard error</th>
<th id="cv" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">cv</th>
<th id="process" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">process</th>
<th id="parameter" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">parameter</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">no tail</th>
<td class="gt_row gt_right" headers="stub-1 reserve">1,540.4</td>
<td class="gt_row gt_right" headers="stub-1 standard-error">173.6</td>
<td class="gt_row gt_right" headers="stub-1 cv">0.113</td>
<td class="gt_row gt_right" headers="stub-1 process">90.8</td>
<td class="gt_row gt_right" headers="stub-1 parameter">148.0</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">fitted tail</th>
<td class="gt_row gt_right" headers="stub-2 reserve">1,634.5</td>
<td class="gt_row gt_right" headers="stub-2 standard-error">204.0</td>
<td class="gt_row gt_right" headers="stub-2 cv">0.125</td>
<td class="gt_row gt_right" headers="stub-2 process">100.1</td>
<td class="gt_row gt_right" headers="stub-2 parameter">177.8</td>
</tr>
</tbody>
</table>


Parameter risk exceeds process risk. A tail changes the standard error more (+17%) than the reserve (+6%), because the tail has its own sigma and standard error. By default, Mack extrapolates both from the factors; `tail_sigma=` and `tail_std_err=` replace them.


# 4. Methods that use an a priori: BF, Benktander, Cape Cod, expected loss

The chain ladder gives full weight to the latest cell. These methods mix it with a **prior** ultimate: the expected loss ratio times the exposure.

| Method | Ultimate | Prior | Trust the data |
|----|----|----|----|
| `ExpectedLoss(apriori)` | prior | given | not at all |
| `BornhuetterFerguson(apriori)` | latest + prior x (1 - 1 / cdf) | given | in what is already paid |
| `Benktander(apriori, n_iters)` | BF repeated [n_iters](../reference/reserving.Benktander.md#prospicio.reserving.Benktander.n_iters) times | given | grows with [n_iters](../reference/reserving.Benktander.md#prospicio.reserving.Benktander.n_iters) |
| `CapeCod(trend, decay)` | BF with a prior estimated from the triangle | estimated | in what is already paid |


``` python
methods = {
    "chain ladder": ChainLadder().fit(tri, "paid"),
    "expected loss": ExpectedLoss(apriori=0.70).fit(tri, "paid", "premium"),
    "Bornhuetter-Ferguson": BornhuetterFerguson(apriori=0.70).fit(tri, "paid", "premium"),
    "Benktander (2 steps)": Benktander(apriori=0.70, n_iters=2).fit(tri, "paid", "premium"),
    "Cape Cod": CapeCod().fit(tri, "paid", "premium"),
}
reserves = {name: list(fit.reserve) + [fit.total_reserve] for name, fit in methods.items()}
(GT(wide(reserves, "method", cols + ["total"]), rowname_col="method")
 .tab_header("Reserve by method and origin", "Thousands of a synthetic currency")
 .fmt_number(cols + ["total"], decimals=0))
```


<style>
#dxyhythnhe 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;
        }

#dxyhythnhe thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#dxyhythnhe p { margin: 0; padding: 0; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #dxyhythnhe .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; }
 #dxyhythnhe .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; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #dxyhythnhe .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; }
 #dxyhythnhe .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; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_column_spanner_outer:first-child { padding-left: 0; }
 #dxyhythnhe .gt_column_spanner_outer:last-child { padding-right: 0; }
 #dxyhythnhe .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%; }
 #dxyhythnhe .gt_spanner_row { border-bottom-style: hidden; }
 #dxyhythnhe .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; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_from_md> :first-child { margin-top: 0; }
 #dxyhythnhe .gt_from_md> :last-child { margin-bottom: 0; }
 #dxyhythnhe .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; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_indent_1 { text-indent: 5px; }
 #dxyhythnhe .gt_indent_2 { text-indent: calc(5px * 2); }
 #dxyhythnhe .gt_indent_3 { text-indent: calc(5px * 3); }
 #dxyhythnhe .gt_indent_4 { text-indent: calc(5px * 4); }
 #dxyhythnhe .gt_indent_5 { text-indent: calc(5px * 5); }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_row_group_first td { border-top-width: 2px; }
 #dxyhythnhe .gt_row_group_first th { border-top-width: 2px; }
 #dxyhythnhe .gt_striped { color: #333333; background-color: #F4F4F4; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #dxyhythnhe .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #dxyhythnhe .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #dxyhythnhe .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #dxyhythnhe .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #dxyhythnhe .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #dxyhythnhe .gt_left { text-align: left; }
 #dxyhythnhe .gt_center { text-align: center; }
 #dxyhythnhe .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #dxyhythnhe .gt_font_normal { font-weight: normal; }
 #dxyhythnhe .gt_font_bold { font-weight: bold; }
 #dxyhythnhe .gt_font_italic { font-style: italic; }
 #dxyhythnhe .gt_super { font-size: 65%; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #dxyhythnhe .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; }
 #dxyhythnhe .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #dxyhythnhe .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #dxyhythnhe .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="9" id="title" class="gt_heading gt_title gt_font_normal">Reserve by method and origin</th>
</tr>
<tr class="gt_heading">
<th colspan="9" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="2018" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2018</th>
<th id="2019" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2019</th>
<th id="2020" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2020</th>
<th id="2021" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2021</th>
<th id="2022" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2022</th>
<th id="2023" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2023</th>
<th id="2024" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2024</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">chain ladder</th>
<td class="gt_row gt_right" headers="stub-1 2018">0</td>
<td class="gt_row gt_right" headers="stub-1 2019">13</td>
<td class="gt_row gt_right" headers="stub-1 2020">42</td>
<td class="gt_row gt_right" headers="stub-1 2021">103</td>
<td class="gt_row gt_right" headers="stub-1 2022">218</td>
<td class="gt_row gt_right" headers="stub-1 2023">435</td>
<td class="gt_row gt_right" headers="stub-1 2024">730</td>
<td class="gt_row gt_right" headers="stub-1 total">1,540</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">expected loss</th>
<td class="gt_row gt_right" headers="stub-2 2018">33</td>
<td class="gt_row gt_right" headers="stub-2 2019">−19</td>
<td class="gt_row gt_right" headers="stub-2 2020">50</td>
<td class="gt_row gt_right" headers="stub-2 2021">134</td>
<td class="gt_row gt_right" headers="stub-2 2022">222</td>
<td class="gt_row gt_right" headers="stub-2 2023">357</td>
<td class="gt_row gt_right" headers="stub-2 2024">622</td>
<td class="gt_row gt_right" headers="stub-2 total">1,399</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">Bornhuetter-Ferguson</th>
<td class="gt_row gt_right" headers="stub-3 2018">0</td>
<td class="gt_row gt_right" headers="stub-3 2019">12</td>
<td class="gt_row gt_right" headers="stub-3 2020">42</td>
<td class="gt_row gt_right" headers="stub-3 2021">107</td>
<td class="gt_row gt_right" headers="stub-3 2022">219</td>
<td class="gt_row gt_right" headers="stub-3 2023">400</td>
<td class="gt_row gt_right" headers="stub-3 2024">655</td>
<td class="gt_row gt_right" headers="stub-3 total">1,436</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">Benktander (2 steps)</th>
<td class="gt_row gt_right" headers="stub-4 2018">0</td>
<td class="gt_row gt_right" headers="stub-4 2019">13</td>
<td class="gt_row gt_right" headers="stub-4 2020">42</td>
<td class="gt_row gt_right" headers="stub-4 2021">103</td>
<td class="gt_row gt_right" headers="stub-4 2022">218</td>
<td class="gt_row gt_right" headers="stub-4 2023">420</td>
<td class="gt_row gt_right" headers="stub-4 2024">678</td>
<td class="gt_row gt_right" headers="stub-4 total">1,474</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">Cape Cod</th>
<td class="gt_row gt_right" headers="stub-5 2018">0</td>
<td class="gt_row gt_right" headers="stub-5 2019">12</td>
<td class="gt_row gt_right" headers="stub-5 2020">43</td>
<td class="gt_row gt_right" headers="stub-5 2021">108</td>
<td class="gt_row gt_right" headers="stub-5 2022">221</td>
<td class="gt_row gt_right" headers="stub-5 2023">404</td>
<td class="gt_row gt_right" headers="stub-5 2024">661</td>
<td class="gt_row gt_right" headers="stub-5 total">1,448</td>
</tr>
</tbody>
</table>


Expected loss ignores what is paid: it puts a reserve of 33 on the closed year 2018 and a negative reserve on 2019 (70% of premium is less than the amount already paid). The real difference is the youngest origin, 2024: 730 for the chain ladder, 655 to 678 with a prior, 622 for expected loss. That is the actuarial judgment you must make.

**Bornhuetter-Ferguson (BF).** The reserve is the prior ultimate times the share still to develop. The paid amount to date does not change the reserve (only the pattern does). This protects against an unusual first cell, but also ignores a good or bad one.

**Use BF when** the origin is young or the pattern is volatile, and the prior comes from outside the triangle (a plan, pricing, a benchmark). **Do not use BF when** the prior is old, or the people under evaluation set it: the method then repeats the error.

**Benktander** uses the ultimate of BF as the new prior and repeats the calculation. `n_iters=0` is the expected loss method, `1` is BF, and many steps give the chain ladder:


``` python
for n in [0, 1, 2, 5, 100]:
    print(n, round(Benktander(apriori=0.70, n_iters=n).fit(tri, "paid", "premium").total_reserve, 1))
```


    0 1399.0
    1 1435.6
    2 1473.6
    5 1521.7
    100 1540.4


[n_iters](../reference/reserving.Benktander.md#prospicio.reserving.Benktander.n_iters) moves the result between the prior (1,399) and the data (1,540). The default is 1 (BF). Use `n_iters=2`, Benktander's own choice, which is near the credibility-optimal mix of BF and the chain ladder (Mack 2000). If you want more steps, use the chain ladder.

**Cape Cod** needs no plan loss ratio. It estimates the loss ratio from the triangle: the paid amount to date divided by the exposure that has developed. [trend](../reference/reserving.CapeCod.md#prospicio.reserving.CapeCod.trend) adjusts each year's ratio by an annual rate to the valuation date. A [decay](../reference/reserving.CapeCod.md#prospicio.reserving.CapeCod.decay) below 1 gives more weight to nearby years. Use `decay=1` and `trend=0` only if the years are exchangeable, which they rarely are in a changing market.


``` python
cc = CapeCod().fit(tri, "paid", "premium")
cc2 = CapeCod(trend=0.03, decay=0.7).fit(tri, "paid", "premium")
priors = pd.DataFrame(
    {"defaults": cc.apriori, "3% trend, decay 0.7": cc2.apriori}, index=cols
).rename_axis("origin").reset_index()
(GT(priors, rowname_col="origin")
 .tab_header("Cape Cod loss ratio by origin")
 .fmt_number(["defaults", "3% trend, decay 0.7"], decimals=3))
```


<style>
#nuqcyecsgu 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;
        }

#nuqcyecsgu thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#nuqcyecsgu p { margin: 0; padding: 0; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_column_spanner_outer:first-child { padding-left: 0; }
 #nuqcyecsgu .gt_column_spanner_outer:last-child { padding-right: 0; }
 #nuqcyecsgu .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%; }
 #nuqcyecsgu .gt_spanner_row { border-bottom-style: hidden; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_from_md> :first-child { margin-top: 0; }
 #nuqcyecsgu .gt_from_md> :last-child { margin-bottom: 0; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_indent_1 { text-indent: 5px; }
 #nuqcyecsgu .gt_indent_2 { text-indent: calc(5px * 2); }
 #nuqcyecsgu .gt_indent_3 { text-indent: calc(5px * 3); }
 #nuqcyecsgu .gt_indent_4 { text-indent: calc(5px * 4); }
 #nuqcyecsgu .gt_indent_5 { text-indent: calc(5px * 5); }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_row_group_first td { border-top-width: 2px; }
 #nuqcyecsgu .gt_row_group_first th { border-top-width: 2px; }
 #nuqcyecsgu .gt_striped { color: #333333; background-color: #F4F4F4; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #nuqcyecsgu .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #nuqcyecsgu .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #nuqcyecsgu .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #nuqcyecsgu .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #nuqcyecsgu .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #nuqcyecsgu .gt_left { text-align: left; }
 #nuqcyecsgu .gt_center { text-align: center; }
 #nuqcyecsgu .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #nuqcyecsgu .gt_font_normal { font-weight: normal; }
 #nuqcyecsgu .gt_font_bold { font-weight: bold; }
 #nuqcyecsgu .gt_font_italic { font-style: italic; }
 #nuqcyecsgu .gt_super { font-size: 65%; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #nuqcyecsgu .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; }
 #nuqcyecsgu .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #nuqcyecsgu .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #nuqcyecsgu .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" 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">Cape Cod loss ratio by origin</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="defaults" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">defaults</th>
<th id="3-trend-decay-0.7" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">3% trend, decay 0.7</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">2018</th>
<td class="gt_row gt_right" headers="stub-1 defaults">0.706</td>
<td class="gt_row gt_right" headers="stub-1 3-trend-decay-0.7">0.665</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">2019</th>
<td class="gt_row gt_right" headers="stub-2 defaults">0.706</td>
<td class="gt_row gt_right" headers="stub-2 3-trend-decay-0.7">0.684</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">2020</th>
<td class="gt_row gt_right" headers="stub-3 defaults">0.706</td>
<td class="gt_row gt_right" headers="stub-3 3-trend-decay-0.7">0.695</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">2021</th>
<td class="gt_row gt_right" headers="stub-4 defaults">0.706</td>
<td class="gt_row gt_right" headers="stub-4 3-trend-decay-0.7">0.706</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">2022</th>
<td class="gt_row gt_right" headers="stub-5 defaults">0.706</td>
<td class="gt_row gt_right" headers="stub-5 3-trend-decay-0.7">0.724</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">2023</th>
<td class="gt_row gt_right" headers="stub-6 defaults">0.706</td>
<td class="gt_row gt_right" headers="stub-6 3-trend-decay-0.7">0.749</td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">2024</th>
<td class="gt_row gt_right" headers="stub-7 defaults">0.706</td>
<td class="gt_row gt_right" headers="stub-7 3-trend-decay-0.7">0.772</td>
</tr>
</tbody>
</table>


**A different prior for each year.** The plan loss ratio often differs by year. Give [apriori](../reference/reserving.Benktander.md#prospicio.reserving.Benktander.apriori) as a dict keyed by accident year. The premium stays in the exposure column. Here the plan expects the loss ratio to fall from 70% to 65% after rate increases:


``` python
elr = [0.70, 0.70, 0.69, 0.68, 0.67, 0.66, 0.65]
plan = dict(zip(years, elr))
bf = BornhuetterFerguson(apriori=plan).fit(tri, "paid", "premium")
flat = methods["Bornhuetter-Ferguson"]
plan_rows = pd.DataFrame(
    {
        "plan": elr + [None],
        "plan reserve": list(bf.reserve) + [bf.total_reserve],
        "flat 70% reserve": list(flat.reserve) + [flat.total_reserve],
    },
    index=cols + ["total"],
).rename_axis("origin").reset_index()
(GT(plan_rows, rowname_col="origin")
 .tab_header("Bornhuetter-Ferguson with a prior for each year", "Reserves in thousands of a synthetic currency")
 .cols_label(plan="plan loss ratio")
 .fmt_number("plan", decimals=2)
 .fmt_number(["plan reserve", "flat 70% reserve"], decimals=0)
 .sub_missing(missing_text=""))
```


<style>
#cynwangcjm 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;
        }

#cynwangcjm thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#cynwangcjm p { margin: 0; padding: 0; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #cynwangcjm .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; }
 #cynwangcjm .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; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #cynwangcjm .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; }
 #cynwangcjm .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; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_column_spanner_outer:first-child { padding-left: 0; }
 #cynwangcjm .gt_column_spanner_outer:last-child { padding-right: 0; }
 #cynwangcjm .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%; }
 #cynwangcjm .gt_spanner_row { border-bottom-style: hidden; }
 #cynwangcjm .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; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_from_md> :first-child { margin-top: 0; }
 #cynwangcjm .gt_from_md> :last-child { margin-bottom: 0; }
 #cynwangcjm .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; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_indent_1 { text-indent: 5px; }
 #cynwangcjm .gt_indent_2 { text-indent: calc(5px * 2); }
 #cynwangcjm .gt_indent_3 { text-indent: calc(5px * 3); }
 #cynwangcjm .gt_indent_4 { text-indent: calc(5px * 4); }
 #cynwangcjm .gt_indent_5 { text-indent: calc(5px * 5); }
 #cynwangcjm .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; }
 #cynwangcjm .gt_row_group_first td { border-top-width: 2px; }
 #cynwangcjm .gt_row_group_first th { border-top-width: 2px; }
 #cynwangcjm .gt_striped { color: #333333; background-color: #F4F4F4; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #cynwangcjm .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #cynwangcjm .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #cynwangcjm .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #cynwangcjm .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #cynwangcjm .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #cynwangcjm .gt_left { text-align: left; }
 #cynwangcjm .gt_center { text-align: center; }
 #cynwangcjm .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #cynwangcjm .gt_font_normal { font-weight: normal; }
 #cynwangcjm .gt_font_bold { font-weight: bold; }
 #cynwangcjm .gt_font_italic { font-style: italic; }
 #cynwangcjm .gt_super { font-size: 65%; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #cynwangcjm .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; }
 #cynwangcjm .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #cynwangcjm .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #cynwangcjm .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">Bornhuetter-Ferguson with a prior for each year</th>
</tr>
<tr class="gt_heading">
<th colspan="4" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Reserves in thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="plan" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">plan loss ratio</th>
<th id="plan-reserve" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">plan reserve</th>
<th id="flat-70-reserve" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">flat 70% reserve</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">2018</th>
<td class="gt_row gt_right" headers="stub-1 plan">0.70</td>
<td class="gt_row gt_right" headers="stub-1 plan-reserve">0</td>
<td class="gt_row gt_right" headers="stub-1 flat-70-reserve">0</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">2019</th>
<td class="gt_row gt_right" headers="stub-2 plan">0.70</td>
<td class="gt_row gt_right" headers="stub-2 plan-reserve">12</td>
<td class="gt_row gt_right" headers="stub-2 flat-70-reserve">12</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">2020</th>
<td class="gt_row gt_right" headers="stub-3 plan">0.69</td>
<td class="gt_row gt_right" headers="stub-3 plan-reserve">42</td>
<td class="gt_row gt_right" headers="stub-3 flat-70-reserve">42</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">2021</th>
<td class="gt_row gt_right" headers="stub-4 plan">0.68</td>
<td class="gt_row gt_right" headers="stub-4 plan-reserve">104</td>
<td class="gt_row gt_right" headers="stub-4 flat-70-reserve">107</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">2022</th>
<td class="gt_row gt_right" headers="stub-5 plan">0.67</td>
<td class="gt_row gt_right" headers="stub-5 plan-reserve">209</td>
<td class="gt_row gt_right" headers="stub-5 flat-70-reserve">219</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">2023</th>
<td class="gt_row gt_right" headers="stub-6 plan">0.66</td>
<td class="gt_row gt_right" headers="stub-6 plan-reserve">377</td>
<td class="gt_row gt_right" headers="stub-6 flat-70-reserve">400</td>
</tr>
<tr>
<th id="stub-7" class="gt_row gt_left gt_stub" scope="row">2024</th>
<td class="gt_row gt_right" headers="stub-7 plan">0.65</td>
<td class="gt_row gt_right" headers="stub-7 plan-reserve">608</td>
<td class="gt_row gt_right" headers="stub-7 flat-70-reserve">655</td>
</tr>
<tr>
<th id="stub-8" class="gt_row gt_left gt_stub" scope="row">total</th>
<td class="gt_row gt_right" headers="stub-8 plan"></td>
<td class="gt_row gt_right" headers="stub-8 plan-reserve">1,353</td>
<td class="gt_row gt_right" headers="stub-8 flat-70-reserve">1,436</td>
</tr>
</tbody>
</table>


Each origin has its own expected ultimate, `apriori[o] * exposure[o]`, for [ExpectedLoss](../reference/reserving.ExpectedLoss.md#prospicio.reserving.ExpectedLoss), [BornhuetterFerguson](../reference/reserving.BornhuetterFerguson.md#prospicio.reserving.BornhuetterFerguson) and [Benktander](../reference/reserving.Benktander.md#prospicio.reserving.Benktander). A list or array in origin order (oldest first) also works, but use the keys when you can: a list can go to the wrong origins without an error. A pandas Series is read by its index, so `df.set_index("origin")["elr"]` lines up in any row order. In R, give a vector named by origin: `apriori = c("2018" = 0.70, ...)`.

The older form puts the expected ultimate in a column, uses it as the exposure and sets `apriori=1.0`. It gives the same reserve. It is still how you give Cape Cod (and Clark's Cape Cod) a column of relativities between years, because they estimate the level again. Here the data raise the plan by 1.034, to a reserve of 1,399:


``` python
expected = [r * p for r, p in zip(elr, premium)]
tri_prior = Triangle.from_long(
    origin, age, {"paid": [v for row in paid for v in row], "prior": [expected[years.index(y)] for y in origin]}
)
bf_col = BornhuetterFerguson(apriori=1.0).fit(tri_prior, "paid", "prior")
print("exposure column form, total", round(bf_col.total_reserve), "same as the dict form:",
      abs(bf_col.total_reserve - bf.total_reserve) < 1e-9)
cc_prior = CapeCod().fit(tri_prior, "paid", "prior")
print(f"Cape Cod on the same column: apriori {cc_prior.apriori[0]:.3f}, total {cc_prior.total_reserve:.0f}")
```


    exposure column form, total 1353 same as the dict form: True
    Cape Cod on the same column: apriori 1.034, total 1399


**Is the result reasonable?** Before you book a method, compare each origin's ultimate loss ratio with the plan:


``` python
ratios = {name: [u / p for u, p in zip(fit.ultimate, premium)] for name, fit in methods.items()}
ratios["plan"] = elr
(GT(wide(ratios, "method", cols), rowname_col="method")
 .tab_header("Ultimate loss ratio by method and origin")
 .fmt_number(cols, decimals=3))
```


<style>
#quhgmwvkon 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;
        }

#quhgmwvkon thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#quhgmwvkon p { margin: 0; padding: 0; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #quhgmwvkon .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; }
 #quhgmwvkon .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; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #quhgmwvkon .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; }
 #quhgmwvkon .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; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_column_spanner_outer:first-child { padding-left: 0; }
 #quhgmwvkon .gt_column_spanner_outer:last-child { padding-right: 0; }
 #quhgmwvkon .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%; }
 #quhgmwvkon .gt_spanner_row { border-bottom-style: hidden; }
 #quhgmwvkon .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; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_from_md> :first-child { margin-top: 0; }
 #quhgmwvkon .gt_from_md> :last-child { margin-bottom: 0; }
 #quhgmwvkon .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; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_indent_1 { text-indent: 5px; }
 #quhgmwvkon .gt_indent_2 { text-indent: calc(5px * 2); }
 #quhgmwvkon .gt_indent_3 { text-indent: calc(5px * 3); }
 #quhgmwvkon .gt_indent_4 { text-indent: calc(5px * 4); }
 #quhgmwvkon .gt_indent_5 { text-indent: calc(5px * 5); }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_row_group_first td { border-top-width: 2px; }
 #quhgmwvkon .gt_row_group_first th { border-top-width: 2px; }
 #quhgmwvkon .gt_striped { color: #333333; background-color: #F4F4F4; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #quhgmwvkon .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #quhgmwvkon .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #quhgmwvkon .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #quhgmwvkon .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #quhgmwvkon .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #quhgmwvkon .gt_left { text-align: left; }
 #quhgmwvkon .gt_center { text-align: center; }
 #quhgmwvkon .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #quhgmwvkon .gt_font_normal { font-weight: normal; }
 #quhgmwvkon .gt_font_bold { font-weight: bold; }
 #quhgmwvkon .gt_font_italic { font-style: italic; }
 #quhgmwvkon .gt_super { font-size: 65%; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #quhgmwvkon .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; }
 #quhgmwvkon .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #quhgmwvkon .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #quhgmwvkon .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" 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">Ultimate loss ratio by method and origin</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="2018" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2018</th>
<th id="2019" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2019</th>
<th id="2020" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2020</th>
<th id="2021" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2021</th>
<th id="2022" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2022</th>
<th id="2023" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2023</th>
<th id="2024" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2024</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">chain ladder</th>
<td class="gt_row gt_right" headers="stub-1 2018">0.667</td>
<td class="gt_row gt_right" headers="stub-1 2019">0.730</td>
<td class="gt_row gt_right" headers="stub-1 2020">0.693</td>
<td class="gt_row gt_right" headers="stub-1 2021">0.673</td>
<td class="gt_row gt_right" headers="stub-1 2022">0.696</td>
<td class="gt_row gt_right" headers="stub-1 2023">0.761</td>
<td class="gt_row gt_right" headers="stub-1 2024">0.780</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">expected loss</th>
<td class="gt_row gt_right" headers="stub-2 2018">0.700</td>
<td class="gt_row gt_right" headers="stub-2 2019">0.700</td>
<td class="gt_row gt_right" headers="stub-2 2020">0.700</td>
<td class="gt_row gt_right" headers="stub-2 2021">0.700</td>
<td class="gt_row gt_right" headers="stub-2 2022">0.700</td>
<td class="gt_row gt_right" headers="stub-2 2023">0.700</td>
<td class="gt_row gt_right" headers="stub-2 2024">0.700</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">Bornhuetter-Ferguson</th>
<td class="gt_row gt_right" headers="stub-3 2018">0.667</td>
<td class="gt_row gt_right" headers="stub-3 2019">0.730</td>
<td class="gt_row gt_right" headers="stub-3 2020">0.693</td>
<td class="gt_row gt_right" headers="stub-3 2021">0.677</td>
<td class="gt_row gt_right" headers="stub-3 2022">0.697</td>
<td class="gt_row gt_right" headers="stub-3 2023">0.734</td>
<td class="gt_row gt_right" headers="stub-3 2024">0.725</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">Benktander (2 steps)</th>
<td class="gt_row gt_right" headers="stub-4 2018">0.667</td>
<td class="gt_row gt_right" headers="stub-4 2019">0.730</td>
<td class="gt_row gt_right" headers="stub-4 2020">0.693</td>
<td class="gt_row gt_right" headers="stub-4 2021">0.674</td>
<td class="gt_row gt_right" headers="stub-4 2022">0.697</td>
<td class="gt_row gt_right" headers="stub-4 2023">0.749</td>
<td class="gt_row gt_right" headers="stub-4 2024">0.742</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">Cape Cod</th>
<td class="gt_row gt_right" headers="stub-5 2018">0.667</td>
<td class="gt_row gt_right" headers="stub-5 2019">0.730</td>
<td class="gt_row gt_right" headers="stub-5 2020">0.693</td>
<td class="gt_row gt_right" headers="stub-5 2021">0.678</td>
<td class="gt_row gt_right" headers="stub-5 2022">0.699</td>
<td class="gt_row gt_right" headers="stub-5 2023">0.736</td>
<td class="gt_row gt_right" headers="stub-5 2024">0.729</td>
</tr>
<tr>
<th id="stub-6" class="gt_row gt_left gt_stub" scope="row">plan</th>
<td class="gt_row gt_right" headers="stub-6 2018">0.700</td>
<td class="gt_row gt_right" headers="stub-6 2019">0.700</td>
<td class="gt_row gt_right" headers="stub-6 2020">0.690</td>
<td class="gt_row gt_right" headers="stub-6 2021">0.680</td>
<td class="gt_row gt_right" headers="stub-6 2022">0.670</td>
<td class="gt_row gt_right" headers="stub-6 2023">0.660</td>
<td class="gt_row gt_right" headers="stub-6 2024">0.650</td>
</tr>
</tbody>
</table>


The chain ladder puts 2023 and 2024 at 0.761 and 0.780, above all earlier years (0.67 to 0.73) and far above the plan. Either the business became worse, or the first cells of the young origins are high and the chain ladder multiplies them by its largest factors. This question, not the arithmetic, decides between the chain ladder and BF for those two years.


# 5. Clark: a growth curve instead of factors

**What it is.** Clark fits a parametric growth curve (`"loglogistic"` or `"weibull"`) and an expected ultimate for each origin, to the incremental losses by over-dispersed Poisson maximum likelihood. [ClarkCapeCod](../reference/reserving.ClarkCapeCod.md#prospicio.reserving.ClarkCapeCod) uses one expected loss ratio times the exposure instead of one ultimate for each origin.

**Use it when** there are few ages, the triangle is noisy from cell to cell, or you want a smooth pattern with few parameters. The fit gives a standard error ([total_standard_error](../reference/reserving.MackFit.md#prospicio.reserving.MackFit.total_standard_error)).

**Do not use it without checks.** The curve sets the tail. By default the curve develops to infinity, and a log-logistic curve has a heavy tail:


``` python
clark = []
for label, model in [
    ("loglogistic, to infinity", ClarkLdf()),
    ("loglogistic, stop at 120", ClarkLdf(max_age=120)),
    ("weibull, to infinity", ClarkLdf("weibull")),
    ("weibull, stop at 120", ClarkLdf("weibull", max_age=120)),
]:
    fit = model.fit(tri, "paid")
    clark.append((label, fit.total_reserve, fit.total_standard_error))
clark.append(("Clark Cape Cod, weibull, 120",
              ClarkCapeCod("weibull", 120).fit(tri, "paid", "premium").total_reserve, float("nan")))
(GT(pd.DataFrame(clark, columns=["curve", "reserve", "standard error"]), rowname_col="curve")
 .tab_header("Clark's reserve by curve", "Thousands of a synthetic currency")
 .fmt_number(["reserve", "standard error"], decimals=0)
 .sub_missing(missing_text=""))
```


<style>
#edijprcszd 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;
        }

#edijprcszd thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#edijprcszd p { margin: 0; padding: 0; }
 #edijprcszd .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; }
 #edijprcszd .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #edijprcszd .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; }
 #edijprcszd .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; }
 #edijprcszd .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; }
 #edijprcszd .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #edijprcszd .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; }
 #edijprcszd .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; }
 #edijprcszd .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; }
 #edijprcszd .gt_column_spanner_outer:first-child { padding-left: 0; }
 #edijprcszd .gt_column_spanner_outer:last-child { padding-right: 0; }
 #edijprcszd .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%; }
 #edijprcszd .gt_spanner_row { border-bottom-style: hidden; }
 #edijprcszd .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; }
 #edijprcszd .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; }
 #edijprcszd .gt_from_md> :first-child { margin-top: 0; }
 #edijprcszd .gt_from_md> :last-child { margin-bottom: 0; }
 #edijprcszd .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; }
 #edijprcszd .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; }
 #edijprcszd .gt_indent_1 { text-indent: 5px; }
 #edijprcszd .gt_indent_2 { text-indent: calc(5px * 2); }
 #edijprcszd .gt_indent_3 { text-indent: calc(5px * 3); }
 #edijprcszd .gt_indent_4 { text-indent: calc(5px * 4); }
 #edijprcszd .gt_indent_5 { text-indent: calc(5px * 5); }
 #edijprcszd .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; }
 #edijprcszd .gt_row_group_first td { border-top-width: 2px; }
 #edijprcszd .gt_row_group_first th { border-top-width: 2px; }
 #edijprcszd .gt_striped { color: #333333; background-color: #F4F4F4; }
 #edijprcszd .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; }
 #edijprcszd .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #edijprcszd .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #edijprcszd .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #edijprcszd .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #edijprcszd .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #edijprcszd .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #edijprcszd .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; }
 #edijprcszd .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #edijprcszd .gt_left { text-align: left; }
 #edijprcszd .gt_center { text-align: center; }
 #edijprcszd .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #edijprcszd .gt_font_normal { font-weight: normal; }
 #edijprcszd .gt_font_bold { font-weight: bold; }
 #edijprcszd .gt_font_italic { font-style: italic; }
 #edijprcszd .gt_super { font-size: 65%; }
 #edijprcszd .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; }
 #edijprcszd .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #edijprcszd .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; }
 #edijprcszd .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #edijprcszd .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #edijprcszd .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">Clark's reserve by curve</th>
</tr>
<tr class="gt_heading">
<th colspan="3" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="reserve" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">reserve</th>
<th id="standard-error" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">standard error</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">loglogistic, to infinity</th>
<td class="gt_row gt_right" headers="stub-1 reserve">5,267</td>
<td class="gt_row gt_right" headers="stub-1 standard-error">1,425</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">loglogistic, stop at 120</th>
<td class="gt_row gt_right" headers="stub-2 reserve">2,407</td>
<td class="gt_row gt_right" headers="stub-2 standard-error">309</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">weibull, to infinity</th>
<td class="gt_row gt_right" headers="stub-3 reserve">2,588</td>
<td class="gt_row gt_right" headers="stub-3 standard-error">538</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">weibull, stop at 120</th>
<td class="gt_row gt_right" headers="stub-4 reserve">2,128</td>
<td class="gt_row gt_right" headers="stub-4 standard-error">289</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">Clark Cape Cod, weibull, 120</th>
<td class="gt_row gt_right" headers="stub-5 reserve">1,985</td>
<td class="gt_row gt_right" headers="stub-5 standard-error"></td>
</tr>
</tbody>
</table>


The curve and the cut-off move the reserve from 2,128 to 5,267. The chain ladder gives 1,540 with no tail and 1,635 with a fitted tail. Check the fit before you use any of these: the curve gives an age-to-age factor between any two ages, `fit.growth(a + 12) / fit.growth(a)`, to compare with the chain ladder's.


``` python
steps = [f"{a} to {a + 12}" for a in range(12, 84, 12)]
factors = {"chain ladder": list(cl.ldf) + [None]}
for label, model in [("loglogistic, inf", ClarkLdf()), ("weibull, 120", ClarkLdf("weibull", max_age=120))]:
    f = model.fit(tri, "paid")
    end = f.max_age if f.max_age is not None else float("inf")
    factors[label] = [f.growth(a + 12) / f.growth(a) for a in range(12, 84, 12)] + [f.growth(84) / f.growth(end)]
(GT(wide(factors, "curve", steps + ["developed at 84"]), rowname_col="curve")
 .tab_header("Age-to-age factors: chain ladder and Clark's curves")
 .fmt_number(steps, decimals=3)
 .fmt_percent("developed at 84", decimals=0)
 .sub_missing(missing_text=""))
```


<style>
#teooxeadbn 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;
        }

#teooxeadbn thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#teooxeadbn p { margin: 0; padding: 0; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #teooxeadbn .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; }
 #teooxeadbn .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; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #teooxeadbn .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; }
 #teooxeadbn .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; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_column_spanner_outer:first-child { padding-left: 0; }
 #teooxeadbn .gt_column_spanner_outer:last-child { padding-right: 0; }
 #teooxeadbn .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%; }
 #teooxeadbn .gt_spanner_row { border-bottom-style: hidden; }
 #teooxeadbn .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; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_from_md> :first-child { margin-top: 0; }
 #teooxeadbn .gt_from_md> :last-child { margin-bottom: 0; }
 #teooxeadbn .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; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_indent_1 { text-indent: 5px; }
 #teooxeadbn .gt_indent_2 { text-indent: calc(5px * 2); }
 #teooxeadbn .gt_indent_3 { text-indent: calc(5px * 3); }
 #teooxeadbn .gt_indent_4 { text-indent: calc(5px * 4); }
 #teooxeadbn .gt_indent_5 { text-indent: calc(5px * 5); }
 #teooxeadbn .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; }
 #teooxeadbn .gt_row_group_first td { border-top-width: 2px; }
 #teooxeadbn .gt_row_group_first th { border-top-width: 2px; }
 #teooxeadbn .gt_striped { color: #333333; background-color: #F4F4F4; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #teooxeadbn .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #teooxeadbn .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #teooxeadbn .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #teooxeadbn .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #teooxeadbn .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #teooxeadbn .gt_left { text-align: left; }
 #teooxeadbn .gt_center { text-align: center; }
 #teooxeadbn .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #teooxeadbn .gt_font_normal { font-weight: normal; }
 #teooxeadbn .gt_font_bold { font-weight: bold; }
 #teooxeadbn .gt_font_italic { font-style: italic; }
 #teooxeadbn .gt_super { font-size: 65%; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #teooxeadbn .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; }
 #teooxeadbn .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #teooxeadbn .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #teooxeadbn .gt_asterisk { font-size: 100%; vertical-align: 0; }
 
</style>

<table class="gt_table" aria-labelledby="title" 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">Age-to-age factors: chain ladder and Clark's curves</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="12-to-24" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">12 to 24</th>
<th id="24-to-36" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">24 to 36</th>
<th id="36-to-48" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">36 to 48</th>
<th id="48-to-60" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">48 to 60</th>
<th id="60-to-72" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">60 to 72</th>
<th id="72-to-84" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">72 to 84</th>
<th id="developed-at-84" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">developed at 84</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">chain ladder</th>
<td class="gt_row gt_right" headers="stub-1 12-to-24">1.804</td>
<td class="gt_row gt_right" headers="stub-1 24-to-36">1.344</td>
<td class="gt_row gt_right" headers="stub-1 36-to-48">1.167</td>
<td class="gt_row gt_right" headers="stub-1 48-to-60">1.089</td>
<td class="gt_row gt_right" headers="stub-1 60-to-72">1.041</td>
<td class="gt_row gt_right" headers="stub-1 72-to-84">1.017</td>
<td class="gt_row gt_right" headers="stub-1 developed-at-84"></td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">loglogistic, inf</th>
<td class="gt_row gt_right" headers="stub-2 12-to-24">1.903</td>
<td class="gt_row gt_right" headers="stub-2 24-to-36">1.276</td>
<td class="gt_row gt_right" headers="stub-2 36-to-48">1.148</td>
<td class="gt_row gt_right" headers="stub-2 48-to-60">1.096</td>
<td class="gt_row gt_right" headers="stub-2 60-to-72">1.069</td>
<td class="gt_row gt_right" headers="stub-2 72-to-84">1.052</td>
<td class="gt_row gt_right" headers="stub-2 developed-at-84">63%</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">weibull, 120</th>
<td class="gt_row gt_right" headers="stub-3 12-to-24">1.923</td>
<td class="gt_row gt_right" headers="stub-3 24-to-36">1.282</td>
<td class="gt_row gt_right" headers="stub-3 36-to-48">1.147</td>
<td class="gt_row gt_right" headers="stub-3 48-to-60">1.091</td>
<td class="gt_row gt_right" headers="stub-3 60-to-72">1.061</td>
<td class="gt_row gt_right" headers="stub-3 72-to-84">1.043</td>
<td class="gt_row gt_right" headers="stub-3 developed-at-84">93%</td>
</tr>
</tbody>
</table>


The curves miss the last two factors (log-logistic 1.069 and 1.052, triangle 1.041 and 1.017) and, in the other direction, the first. A two-parameter curve cannot bend enough for this pattern, so it puts too much development after 84 months (the log-logistic curve says that only 63% is paid at 84 months).

On a triangle this mature, use Clark as a comparison, not as the booked method. Use it when the triangle has few ages and the factors are too noisy to read one by one. Set [max_age](../reference/reserving.Triangle.md#prospicio.reserving.Triangle.max_age) to the age at which you think that development stops.


# 6. When you need a distribution, not a number

The methods above give a mean and at most a standard error. A 99.5% capital figure, an adverse development cover, a risk margin and a reserve range need a distribution. prospicio has four methods for this: the three below and `Meyers`. Select one by the variance structure that you think is correct.

|  | [OdpBootstrap](../reference/reserving.OdpBootstrap.md#prospicio.reserving.OdpBootstrap) | [MackBootstrap](../reference/reserving.MackBootstrap.md#prospicio.reserving.MackBootstrap) | `BayesOdp` |
|----|----|----|----|
| Model | Over-dispersed Poisson on increments | Mack's model on link ratios | Over-dispersed Poisson with priors |
| Variance | scale x mean increment | Mack's: sigma squared per age, times the cumulative value | scale x mean increment |
| Reproduces | R `BootChainLadder` | Mack's standard error, Merz-Wuthrich one-year | The ODP model with priors (England and Verrall) |
| Negative cells | allowed | not allowed | allowed |
| Tail | yes | yes | no |


## The two bootstraps


``` python
odp = OdpBootstrap(n_sims=10_000, seed=1).fit(tri, "paid")
mb = MackBootstrap(n_sims=10_000, seed=1).fit(tri, "paid")
compare = pd.DataFrame({
    "method": ["ODP bootstrap", "Mack bootstrap", "Mack formula"],
    "mean": [odp.reserves.mean(), mb.reserves.mean(), mack.total_reserve],
    "std dev": [odp.reserves.variance() ** 0.5, mb.reserves.variance() ** 0.5, mack.total_standard_error],
    "99.5%": [odp.reserves.quantile(0.995), mb.reserves.quantile(0.995), None],
})
(GT(compare, rowname_col="method")
 .tab_header("Total reserve by method", "Thousands of a synthetic currency")
 .fmt_number(["mean", "std dev", "99.5%"], decimals=0)
 .sub_missing(missing_text=""))
```


<style>
#xvlmthwozh 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;
        }

#xvlmthwozh thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#xvlmthwozh p { margin: 0; padding: 0; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #xvlmthwozh .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; }
 #xvlmthwozh .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; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #xvlmthwozh .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; }
 #xvlmthwozh .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; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_column_spanner_outer:first-child { padding-left: 0; }
 #xvlmthwozh .gt_column_spanner_outer:last-child { padding-right: 0; }
 #xvlmthwozh .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%; }
 #xvlmthwozh .gt_spanner_row { border-bottom-style: hidden; }
 #xvlmthwozh .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; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_from_md> :first-child { margin-top: 0; }
 #xvlmthwozh .gt_from_md> :last-child { margin-bottom: 0; }
 #xvlmthwozh .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; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_indent_1 { text-indent: 5px; }
 #xvlmthwozh .gt_indent_2 { text-indent: calc(5px * 2); }
 #xvlmthwozh .gt_indent_3 { text-indent: calc(5px * 3); }
 #xvlmthwozh .gt_indent_4 { text-indent: calc(5px * 4); }
 #xvlmthwozh .gt_indent_5 { text-indent: calc(5px * 5); }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_row_group_first td { border-top-width: 2px; }
 #xvlmthwozh .gt_row_group_first th { border-top-width: 2px; }
 #xvlmthwozh .gt_striped { color: #333333; background-color: #F4F4F4; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #xvlmthwozh .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #xvlmthwozh .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #xvlmthwozh .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #xvlmthwozh .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #xvlmthwozh .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #xvlmthwozh .gt_left { text-align: left; }
 #xvlmthwozh .gt_center { text-align: center; }
 #xvlmthwozh .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #xvlmthwozh .gt_font_normal { font-weight: normal; }
 #xvlmthwozh .gt_font_bold { font-weight: bold; }
 #xvlmthwozh .gt_font_italic { font-style: italic; }
 #xvlmthwozh .gt_super { font-size: 65%; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #xvlmthwozh .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; }
 #xvlmthwozh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #xvlmthwozh .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #xvlmthwozh .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">Total reserve by method</th>
</tr>
<tr class="gt_heading">
<th colspan="4" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="mean" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">mean</th>
<th id="std-dev" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">std dev</th>
<th id="99.5" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">99.5%</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">ODP bootstrap</th>
<td class="gt_row gt_right" headers="stub-1 mean">1,544</td>
<td class="gt_row gt_right" headers="stub-1 std-dev">125</td>
<td class="gt_row gt_right" headers="stub-1 99.5">1,881</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">Mack bootstrap</th>
<td class="gt_row gt_right" headers="stub-2 mean">1,541</td>
<td class="gt_row gt_right" headers="stub-2 std-dev">174</td>
<td class="gt_row gt_right" headers="stub-2 99.5">1,981</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">Mack formula</th>
<td class="gt_row gt_right" headers="stub-3 mean">1,540</td>
<td class="gt_row gt_right" headers="stub-3 std-dev">174</td>
<td class="gt_row gt_right" headers="stub-3 99.5"></td>
</tr>
</tbody>
</table>


The Mack bootstrap agrees with Mack's formula in mean and standard deviation. The ODP bootstrap has the same mean and a smaller standard deviation, because the ODP sets the process variance in proportion to the increment and Mack's formula in proportion to the cumulative value. These are different assumptions, and neither is wrong. The knowledge note [`mack-bootstrap-lifetime-vs-mack.md`](../../knowledge/findings/mack-bootstrap-lifetime-vs-mack.md) records the reconciliation. At the 99.5% level that a capital model reads, the two differ by 100.


``` python
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
bins = list(range(1200, 2300, 25))
ax.hist(odp.reserves.total().draws, bins=bins, histtype="step", linewidth=2, label="ODP bootstrap")
ax.hist(mb.reserves.total().draws, bins=bins, histtype="step", linewidth=2, label="Mack bootstrap")
ax.axvline(mack.total_reserve, color="0.75", linestyle=":")
ax.set_xlabel("total reserve (thousands; dotted: the Mack reserve)")
ax.set_ylabel("simulations out of 10,000")
ax.set_title("Total reserve: the two bootstraps")
ax.legend()
```


<figure class="p-figure figure">
pOyBzdHJva2U6IHZhcigtLXAtbXV0ZWQpOyBzdHJva2Utd2lkdGg6IDAuOCIgLz4KICAgICAgPC9nPgogICAgIDwvZz4KICAgICA8ZyBpZD0idGV4dF82Ij4KICAgICAgPHRleHQgc3R5bGU9ImZvbnQtc2l6ZTogMTFweDsgZm9udC1mYW1pbHk6IHZhcigtLXAtZm9udCk7IHRleHQtYW5jaG9yOiBtaWRkbGU7IGZpbGw6IHZhcigtLXAtbXV0ZWQpIiB4PSIzOTguMjY4NzgiIHk9IjIzNy4yNTk1NDciIHRyYW5zZm9ybT0icm90YXRlKC0wIDM5OC4yNjg3OCAyMzcuMjU5NTQ3KSI+MjIwMDwvdGV4dD4KICAgICA8L2c+CiAgICA8L2c+CiAgICA8ZyBpZD0idGV4dF83Ij4KICAgICA8dGV4dCBzdHlsZT0iZm9udC1zaXplOiAxMXB4OyBmb250LWZhbWlseTogdmFyKC0tcC1mb250KTsgdGV4dC1hbmNob3I6IG1pZGRsZTsgZmlsbDogdmFyKC0tcC1tdXRlZCkiIHg9IjI0NS40OTcxMDkiIHk9IjI1Mi4yNjA0MDYiIHRyYW5zZm9ybT0icm90YXRlKC0wIDI0NS40OTcxMDkgMjUyLjI2MDQwNikiPnRvdGFsIHJlc2VydmUgKHRob3VzYW5kczsgZG90dGVkOiB0aGUgTWFjayByZXNlcnZlKTwvdGV4dD4KICAgIDwvZz4KICAgPC9nPgogICA8ZyBpZD0ibWF0cGxvdGxpYi5heGlzXzIiPgogICAgPGcgaWQ9Inl0aWNrXzEiPgogICAgIDxnIGlkPSJsaW5lMmRfMTMiPgogICAgICA8cGF0aCBkPSJNIDUwLjE5Nz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XRoPgogPC9kZWZzPgo8L3N2Zz4=" />
</figure>


Use [MackBootstrap](../reference/reserving.MackBootstrap.md#prospicio.reserving.MackBootstrap) when the distribution must agree with the standard error of Mack. Use [OdpBootstrap](../reference/reserving.OdpBootstrap.md#prospicio.reserving.OdpBootstrap) for agreement with R `BootChainLadder`, or when a triangle has a negative increment. Both use the volume-weighted chain ladder by default and give `fit.reserves`, a joint distribution by origin with [mean()](../reference/esg.Cir.md#prospicio.esg.Cir.mean), `quantile(p)`, [variance()](../reference/esg.Cir.md#prospicio.esg.Cir.variance), `tvar(p)` and [total()](../reference/risk.Allocation.md#prospicio.risk.Allocation.total).

**Read the tail carefully.** A 99.5% quantile from 10,000 simulations uses the worst 50 of them. Run again with other seeds to see the simulation error:


``` python
seeds = []
for seed in [1, 2, 3]:
    o = OdpBootstrap(n_sims=10_000, seed=seed).fit(tri, "paid").reserves
    m = MackBootstrap(n_sims=10_000, seed=seed).fit(tri, "paid").reserves
    seeds.append((str(seed), o.quantile(0.995), m.quantile(0.995)))
(GT(pd.DataFrame(seeds, columns=["seed", "ODP", "Mack"]), rowname_col="seed")
 .tab_header("99.5% of the total reserve by seed", "Thousands of a synthetic currency")
 .fmt_number(["ODP", "Mack"], decimals=0))
```


<style>
#hajgbcuizt 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;
        }

#hajgbcuizt thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#hajgbcuizt p { margin: 0; padding: 0; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #hajgbcuizt .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; }
 #hajgbcuizt .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; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #hajgbcuizt .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; }
 #hajgbcuizt .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; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_column_spanner_outer:first-child { padding-left: 0; }
 #hajgbcuizt .gt_column_spanner_outer:last-child { padding-right: 0; }
 #hajgbcuizt .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%; }
 #hajgbcuizt .gt_spanner_row { border-bottom-style: hidden; }
 #hajgbcuizt .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; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_from_md> :first-child { margin-top: 0; }
 #hajgbcuizt .gt_from_md> :last-child { margin-bottom: 0; }
 #hajgbcuizt .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; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_indent_1 { text-indent: 5px; }
 #hajgbcuizt .gt_indent_2 { text-indent: calc(5px * 2); }
 #hajgbcuizt .gt_indent_3 { text-indent: calc(5px * 3); }
 #hajgbcuizt .gt_indent_4 { text-indent: calc(5px * 4); }
 #hajgbcuizt .gt_indent_5 { text-indent: calc(5px * 5); }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_row_group_first td { border-top-width: 2px; }
 #hajgbcuizt .gt_row_group_first th { border-top-width: 2px; }
 #hajgbcuizt .gt_striped { color: #333333; background-color: #F4F4F4; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #hajgbcuizt .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #hajgbcuizt .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #hajgbcuizt .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #hajgbcuizt .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #hajgbcuizt .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #hajgbcuizt .gt_left { text-align: left; }
 #hajgbcuizt .gt_center { text-align: center; }
 #hajgbcuizt .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #hajgbcuizt .gt_font_normal { font-weight: normal; }
 #hajgbcuizt .gt_font_bold { font-weight: bold; }
 #hajgbcuizt .gt_font_italic { font-style: italic; }
 #hajgbcuizt .gt_super { font-size: 65%; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #hajgbcuizt .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; }
 #hajgbcuizt .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #hajgbcuizt .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #hajgbcuizt .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">99.5% of the total reserve by seed</th>
</tr>
<tr class="gt_heading">
<th colspan="3" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="ODP" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">ODP</th>
<th id="Mack" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">Mack</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">1</th>
<td class="gt_row gt_right" headers="stub-1 ODP">1,881</td>
<td class="gt_row gt_right" headers="stub-1 Mack">1,981</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">2</th>
<td class="gt_row gt_right" headers="stub-2 ODP">1,884</td>
<td class="gt_row gt_right" headers="stub-2 Mack">1,987</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">3</th>
<td class="gt_row gt_right" headers="stub-3 ODP">1,890</td>
<td class="gt_row gt_right" headers="stub-3 Mack">1,984</td>
</tr>
</tbody>
</table>


The seeds move the 99.5% by less than 10, far less than the 100 between the two models. The large errors are in no bootstrap: seven years of residuals are a small sample from which to learn a tail shape, and model error (the choice of method and tail, an inflation shock) adds to it. Treat a 99.5% from a triangle of this size as a central estimate of a very uncertain number.

**Tails.** Use `tail=` and, for a constant, `tail_std_err=`. The bootstrap refits an estimated tail ([TailCurve](../reference/reserving.TailCurve.md#prospicio.reserving.TailCurve), [TailBondy](../reference/reserving.TailBondy.md#prospicio.reserving.TailBondy), [TailLogLinear](../reference/reserving.TailLogLinear.md#prospicio.reserving.TailLogLinear)) on each simulation, which adds its own parameter error. A constant tail varies in [OdpBootstrap](../reference/reserving.OdpBootstrap.md#prospicio.reserving.OdpBootstrap) only with [tail_std_err](../reference/reserving.Mack.md#prospicio.reserving.Mack.tail_std_err); [MackBootstrap](../reference/reserving.MackBootstrap.md#prospicio.reserving.MackBootstrap) without it extrapolates the standard error of Mack.


``` python
tail = TailConstant(1.02)
boot = MackBootstrap(n_sims=10_000, seed=1, tail=tail, tail_std_err=0.01)
lifetime = boot.fit(tri, "paid")
one_year = boot.one_year(tri, "paid", ChainLadder(tail=tail))
print(f"lifetime  mean {lifetime.reserves.mean():.0f}  std dev {lifetime.reserves.variance() ** 0.5:.0f}")
print(f"one-year  mean {one_year.cdr.mean():.0f}  std dev {one_year.cdr.variance() ** 0.5:.0f}")
```


    lifetime  mean 1660  std dev 191
    one-year  mean 2  std dev 130


The tail raises the lifetime mean to 1,660 (the plug-in chain ladder with that tail gives 1,657.5) and the standard deviation to 191. The one-year mean is about zero and its standard deviation is 130, against 127.2 without a tail (section 7).

Pitfall: an estimated tail that the ODP refits on its pseudo factors is sometimes exactly 1. The ODP bootstrap with [TailLogLinear](../reference/reserving.TailLogLinear.md#prospicio.reserving.TailLogLinear) is therefore less stable than a constant with a standard error (the finding [`bootstrap-tail-parameter-error.md`](../../knowledge/findings/bootstrap-tail-parameter-error.md)).


## Bayesian models

**`BayesOdp`** puts normal priors on the log-scale origin and development effects of the same ODP model. It samples the posterior with NUTS and gives the posterior predictive distribution of the reserve. The priors are on the log-scale effects, not on an ultimate or a loss ratio, so they are hard to state from actuarial judgment. `intercept_sd`, `origin_sd` and `development_sd` set their widths (10 by default). It takes a cumulative triangle with no tail and no exposure column.


``` python
import warnings
with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    bayes = BayesOdp(n_sims=10_000, seed=1).fit(tri, "paid")
d = bayes.diagnostics
print("warnings", len(caught), "| max R-hat below 1.01:", d["max_rhat"] < 1.01, "| divergences", d["divergences"])
print(f"posterior predictive mean / chain ladder reserve {bayes.reserves.mean() / cl.total_reserve:.2f}")
print(f"posterior predictive std dev / ODP bootstrap std dev {bayes.reserves.variance() ** 0.5 / odp.reserves.variance() ** 0.5:.1f}")
```


    warnings 0 | max R-hat below 1.01: True | divergences 0
    posterior predictive mean / chain ladder reserve 1.00
    posterior predictive std dev / ODP bootstrap std dev 1.0


With the wide default priors, the posterior predictive mean and standard deviation equal the chain ladder's and the ODP bootstrap's, as a Bayesian fit with weak priors must give. The finding [`bayes-odp-vs-odp-bootstrap.md`](../../knowledge/findings/bayes-odp-vs-odp-bootstrap.md) compares them with Stan.

Always read `fit.diagnostics` (R-hat, effective sample sizes, divergences). When the sampler fails, the library does not stop: it gives one `UserWarning` (0 here). Do not report a posterior if you did not read its warning.

With its default priors, `BayesOdp` repeats the ODP bootstrap by a different method. Use it to put a belief about the origin levels or the development pattern into the model. A smaller `origin_sd`, for example, moves each origin's level toward the first origin's, because each prior is centred at 0. For a prior on the loss ratio, which an actuary usually has, use `Meyers`.

**`Meyers`** fits the log-normal models of Meyers (CAS Monograph 8): `"crc"` (correlated chain ladder, without the correlation between origins) and `"csr"` (changing settlement rate). It takes the premium as a base (`fit(tri, "paid", "premium")`) and puts a prior on the log loss ratio. The standard deviation of the log value decreases with age. All observed cells must be positive. Its ultimate is the value at the oldest age, so there is no tail.


``` python
with warnings.catch_warnings():
    warnings.simplefilter("ignore")  # the sampler warns when its diagnostics fail
    meyers = Meyers("crc", n_sims=5000, seed=1).fit(tri, "paid", "premium")
print("Meyers std dev more than twice the ODP bootstrap's:", meyers.reserves.variance() ** 0.5 > 2 * odp.reserves.variance() ** 0.5)
```


    Meyers std dev more than twice the ODP bootstrap's: True


It needs more data than this example has. On this 7 by 7 triangle the log-normal ultimates are very uncertain, and the sampler can warn that its diagnostics fail. Use it on triangles like those of Meyers (10 by 10 with premium), and read the diagnostics before the reserve. The knowledge note [`meyers-crc-csr-parity.md`](../../knowledge/findings/meyers-crc-csr-parity.md) gives the parity checks.


# 7. Lifetime or one-year?

The bootstraps above give the **lifetime** (run-off) view: the uncertainty in the reserve until the last claim is paid. A solvency standard asks for the **one-year view**: the uncertainty over the next year, the **claims development result (CDR)**. It is smaller because it excludes what occurs after next year.

| Question | View | Call |
|----|----|----|
| Reserve range, ADC or LPT pricing, IFRS 17 run-off | Lifetime | [fit()](../reference/risk.Gpd.md#prospicio.risk.Gpd.fit) |
| Solvency II reserve risk, a 99.5% one-year loss | One-year | [claims_development_result()](../reference/reserving.MackFit.md#prospicio.reserving.MackFit.claims_development_result) or [one_year()](../reference/reserving.OdpBootstrap.md#prospicio.reserving.OdpBootstrap.one_year) |


``` python
mw = mack.claims_development_result()
mack_1y = MackBootstrap(n_sims=10_000, seed=1).one_year(tri, "paid", ChainLadder())
odp_1y = OdpBootstrap(n_sims=10_000, seed=1).one_year(tri, "paid", ChainLadder())
bf_1y = MackBootstrap(n_sims=10_000, seed=1).one_year(tri, "paid", BornhuetterFerguson(0.70), exposure="premium")
one_year_rows = pd.DataFrame(
    [
        ("Mack lifetime (formula)", mack.total_standard_error, None),
        ("Merz-Wuthrich one-year", mw.total_one_year_standard_error, None),
        ("Mack bootstrap one-year", mack_1y.cdr.variance() ** 0.5, mack_1y.cdr.mean()),
        ("ODP bootstrap one-year", odp_1y.cdr.variance() ** 0.5, odp_1y.cdr.mean()),
        ("Bornhuetter-Ferguson one-year", bf_1y.cdr.variance() ** 0.5, bf_1y.cdr.mean()),
    ],
    columns=["view", "std dev", "mean CDR"],
)
(GT(one_year_rows, rowname_col="view")
 .tab_header("Reserve risk: lifetime and one-year", "Thousands of a synthetic currency")
 .fmt_number(["std dev", "mean CDR"], decimals=1)
 .sub_missing(missing_text=""))
```


<style>
#pzmuuorlre 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;
        }

#pzmuuorlre thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#pzmuuorlre p { margin: 0; padding: 0; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #pzmuuorlre .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; }
 #pzmuuorlre .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; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #pzmuuorlre .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; }
 #pzmuuorlre .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; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_column_spanner_outer:first-child { padding-left: 0; }
 #pzmuuorlre .gt_column_spanner_outer:last-child { padding-right: 0; }
 #pzmuuorlre .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%; }
 #pzmuuorlre .gt_spanner_row { border-bottom-style: hidden; }
 #pzmuuorlre .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; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_from_md> :first-child { margin-top: 0; }
 #pzmuuorlre .gt_from_md> :last-child { margin-bottom: 0; }
 #pzmuuorlre .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; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_indent_1 { text-indent: 5px; }
 #pzmuuorlre .gt_indent_2 { text-indent: calc(5px * 2); }
 #pzmuuorlre .gt_indent_3 { text-indent: calc(5px * 3); }
 #pzmuuorlre .gt_indent_4 { text-indent: calc(5px * 4); }
 #pzmuuorlre .gt_indent_5 { text-indent: calc(5px * 5); }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_row_group_first td { border-top-width: 2px; }
 #pzmuuorlre .gt_row_group_first th { border-top-width: 2px; }
 #pzmuuorlre .gt_striped { color: #333333; background-color: #F4F4F4; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #pzmuuorlre .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #pzmuuorlre .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #pzmuuorlre .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #pzmuuorlre .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #pzmuuorlre .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #pzmuuorlre .gt_left { text-align: left; }
 #pzmuuorlre .gt_center { text-align: center; }
 #pzmuuorlre .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #pzmuuorlre .gt_font_normal { font-weight: normal; }
 #pzmuuorlre .gt_font_bold { font-weight: bold; }
 #pzmuuorlre .gt_font_italic { font-style: italic; }
 #pzmuuorlre .gt_super { font-size: 65%; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #pzmuuorlre .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; }
 #pzmuuorlre .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #pzmuuorlre .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #pzmuuorlre .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">Reserve risk: lifetime and one-year</th>
</tr>
<tr class="gt_heading">
<th colspan="3" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Thousands of a synthetic currency</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="std-dev" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">std dev</th>
<th id="mean-CDR" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">mean CDR</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">Mack lifetime (formula)</th>
<td class="gt_row gt_right" headers="stub-1 std-dev">173.6</td>
<td class="gt_row gt_right" headers="stub-1 mean-CDR"></td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">Merz-Wuthrich one-year</th>
<td class="gt_row gt_right" headers="stub-2 std-dev">127.1</td>
<td class="gt_row gt_right" headers="stub-2 mean-CDR"></td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">Mack bootstrap one-year</th>
<td class="gt_row gt_right" headers="stub-3 std-dev">127.2</td>
<td class="gt_row gt_right" headers="stub-3 mean-CDR">−1.2</td>
</tr>
<tr>
<th id="stub-4" class="gt_row gt_left gt_stub" scope="row">ODP bootstrap one-year</th>
<td class="gt_row gt_right" headers="stub-4 std-dev">100.5</td>
<td class="gt_row gt_right" headers="stub-4 mean-CDR">−1.6</td>
</tr>
<tr>
<th id="stub-5" class="gt_row gt_left gt_stub" scope="row">Bornhuetter-Ferguson one-year</th>
<td class="gt_row gt_right" headers="stub-5 std-dev">102.5</td>
<td class="gt_row gt_right" headers="stub-5 mean-CDR">−38.8</td>
</tr>
</tbody>
</table>


``` python
print("one-year 99.5% loss:", round(-mack_1y.cdr.quantile(0.005)))
```


    one-year 99.5% loss: 326


How to read the results:

- The one-year standard error of the chain ladder is 127.1 by Merz-Wuthrich, against 173.6 for the lifetime. `MackBootstrap().one_year` reproduces it (127.2, with a mean CDR of -1.2, about zero).
- The ODP gives 100.5 with the same re-reserving, from its process model. The ratio to Merz-Wuthrich differs by triangle (the finding [`one-year-bootstrap-vs-merz-wuthrich.md`](../../knowledge/findings/one-year-bootstrap-vs-merz-wuthrich.md)). Use [MackBootstrap](../reference/reserving.MackBootstrap.md#prospicio.reserving.MackBootstrap) when the figure must agree with Merz-Wuthrich.
- [one_year](../reference/reserving.OdpBootstrap.md#prospicio.reserving.OdpBootstrap.one_year) accepts [ChainLadder](../reference/reserving.ChainLadder.md#prospicio.reserving.ChainLadder), [ExpectedLoss](../reference/reserving.ExpectedLoss.md#prospicio.reserving.ExpectedLoss), [BornhuetterFerguson](../reference/reserving.BornhuetterFerguson.md#prospicio.reserving.BornhuetterFerguson), [Benktander](../reference/reserving.Benktander.md#prospicio.reserving.Benktander) or [CapeCod](../reference/reserving.CapeCod.md#prospicio.reserving.CapeCod) as [method](../reference/risk.Allocation.md#prospicio.risk.Allocation.method), with any averaging, tail or development grain. The closed form does not. For the expected-loss methods, give `exposure=`.
- The simulated next diagonal always follows the bootstrap's process (here Mack's); the method only re-estimates on it. The Bornhuetter-Ferguson row is thus the risk of a BF estimate in a chain ladder world. Its mean CDR of -38.8 is not zero, because BF opens below the chain ladder (1,436 against 1,540) and one more diagonal moves it toward the chain ladder. Do not read its 102.5 against 127.2 as "BF has less reserve risk", and state the offset when a CDR with a non-zero mean goes into a capital figure.
- A one-year loss is a negative CDR: `-cdr.quantile(0.005)` is the one-year 99.5% loss, here 326.
- With a bootstrap [tail](../reference/reserving.Mack.md#prospicio.reserving.Mack.tail), an origin whose tail step is in the next year takes all of the tail in that year, so its one-year risk is an upper bound.


# 8. Several lines and dependence

A triangle with [keys](../reference/reserving.MackFit.md#prospicio.reserving.MackFit.keys) holds several segments. A bootstrap fit on all segments gives one joint distribution, and [dependence](../reference/reserving.OdpBootstrap.md#prospicio.reserving.OdpBootstrap.dependence) sets how the lines move together.

| [dependence](../reference/reserving.OdpBootstrap.md#prospicio.reserving.OdpBootstrap.dependence) | What it does | Use it when |
|----|----|----|
| `"independent"` | Each line resamples its own residuals | The lines are not related, or as a lower bound when you expect no negative correlation |
| `"synchronized"` | All lines take the residuals of the same origins and ages | All lines have the same shape of data, and you think that the residuals correlate |
| `"rank_correlation"` with `spearman=` | Iman-Conover reorders the simulations of the lines to your Spearman matrix | You have a correlation from a different source: the matrix of a regulator, or your own study of the calendar-year results of the lines |

Synchronized resampling needs the same origins, ages and observed cells in all lines. Its correlation is that of the lines' residuals, reduced by process error. Here the second line is half of the first, so the residuals are almost identical and the correlation is larger than in a real pair of lines.


``` python
vals = [v for row in paid for v in row]
two = Triangle.from_long(
    origin * 2,
    age * 2,
    {"paid": vals + [round(0.5 * v) for v in vals]},
    keys={"line": ["property"] * len(vals) + ["liability"] * len(vals)},
)
dep_rows = []
for dependence, extra in [("independent", {}), ("synchronized", {}), ("rank_correlation", {"spearman": [[1, 0.5], [0.5, 1]]})]:
    r = OdpBootstrap(n_sims=5000, seed=2, dependence=dependence, **extra).fit(two, "paid").reserves
    by_line = r.aggregate(["line"])
    dep_rows.append((dependence, r.variance() ** 0.5, r.quantile(0.995),
                     *(by_line.marginal((k,)).variance() ** 0.5 for k in ["property", "liability"])))
(GT(pd.DataFrame(dep_rows, columns=["dependence", "total", "total 99.5%", "property", "liability"]),
    rowname_col="dependence")
 .tab_header("Reserve risk of two lines", "Standard deviation, except the 99.5% of the total")
 .fmt_number(["total", "property", "liability"], decimals=1)
 .fmt_number("total 99.5%", decimals=0))
```


<style>
#isqarmuhlh 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;
        }

#isqarmuhlh thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#isqarmuhlh p { margin: 0; padding: 0; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #isqarmuhlh .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; }
 #isqarmuhlh .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; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #isqarmuhlh .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; }
 #isqarmuhlh .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; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_column_spanner_outer:first-child { padding-left: 0; }
 #isqarmuhlh .gt_column_spanner_outer:last-child { padding-right: 0; }
 #isqarmuhlh .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%; }
 #isqarmuhlh .gt_spanner_row { border-bottom-style: hidden; }
 #isqarmuhlh .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; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_from_md> :first-child { margin-top: 0; }
 #isqarmuhlh .gt_from_md> :last-child { margin-bottom: 0; }
 #isqarmuhlh .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; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_indent_1 { text-indent: 5px; }
 #isqarmuhlh .gt_indent_2 { text-indent: calc(5px * 2); }
 #isqarmuhlh .gt_indent_3 { text-indent: calc(5px * 3); }
 #isqarmuhlh .gt_indent_4 { text-indent: calc(5px * 4); }
 #isqarmuhlh .gt_indent_5 { text-indent: calc(5px * 5); }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_row_group_first td { border-top-width: 2px; }
 #isqarmuhlh .gt_row_group_first th { border-top-width: 2px; }
 #isqarmuhlh .gt_striped { color: #333333; background-color: #F4F4F4; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #isqarmuhlh .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #isqarmuhlh .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #isqarmuhlh .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #isqarmuhlh .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #isqarmuhlh .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #isqarmuhlh .gt_left { text-align: left; }
 #isqarmuhlh .gt_center { text-align: center; }
 #isqarmuhlh .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #isqarmuhlh .gt_font_normal { font-weight: normal; }
 #isqarmuhlh .gt_font_bold { font-weight: bold; }
 #isqarmuhlh .gt_font_italic { font-style: italic; }
 #isqarmuhlh .gt_super { font-size: 65%; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #isqarmuhlh .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; }
 #isqarmuhlh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #isqarmuhlh .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #isqarmuhlh .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">Reserve risk of two lines</th>
</tr>
<tr class="gt_heading">
<th colspan="5" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Standard deviation, except the 99.5% of the total</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="total" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">total</th>
<th id="total-99.5" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">total 99.5%</th>
<th id="property" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">property</th>
<th id="liability" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">liability</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">independent</th>
<td class="gt_row gt_right" headers="stub-1 total">138.8</td>
<td class="gt_row gt_right" headers="stub-1 total-99.5">2,695</td>
<td class="gt_row gt_right" headers="stub-1 property">125.0</td>
<td class="gt_row gt_right" headers="stub-1 liability">60.3</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">synchronized</th>
<td class="gt_row gt_right" headers="stub-2 total">176.6</td>
<td class="gt_row gt_right" headers="stub-2 total-99.5">2,779</td>
<td class="gt_row gt_right" headers="stub-2 property">126.0</td>
<td class="gt_row gt_right" headers="stub-2 liability">60.3</td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">rank_correlation</th>
<td class="gt_row gt_right" headers="stub-3 total">164.5</td>
<td class="gt_row gt_right" headers="stub-3 total-99.5">2,751</td>
<td class="gt_row gt_right" headers="stub-3 property">125.0</td>
<td class="gt_row gt_right" headers="stub-3 liability">60.3</td>
</tr>
</tbody>
</table>


Dependence does not change the standard deviation of a line, but it widens the total. The triangle does not estimate the Spearman correlation of 0.5: it is an input. Take it from a regulator's matrix or your own study, then test how much the total changes with it. `fit.reserves.aggregate(["line"])` gives the reserve of each line and keeps the dependence between them.


# 9. Which method is right? Backtest it

No method is right in general. One method is right for your book. A **diagonal backtest** refits the triangle without its newest calendar diagonal, forecasts that diagonal and compares. An actual-over-expected ratio near 1, with no drift, supports the assumptions of the method.

The loop below is a chain ladder backtest on an annual triangle. It fits the cells with a valuation before a calendar year, then compares the next diagonal with the forecast `latest x age-to-age factor`.


``` python
long = tri.to_long()
valuation_year = [o.year + dev // 12 - 1 for o, dev in zip(long["origin"], long["development"])]
actual = {(o.year, dev): v for o, dev, v in zip(long["origin"], long["development"], long["paid"])}

def backtest(year):
    keep = [i for i, y in enumerate(valuation_year) if y < year]
    train = Triangle.from_long(
        [long["origin"][i] for i in keep],
        [long["development"][i] for i in keep],
        {"paid": [long["paid"][i] for i in keep]},
    )
    ldf = ChainLadder().fit(train, "paid").ldf
    pairs = {}  # origin: (observed, forecast)
    for oy in range(2018, year):
        k = year - oy
        if k - 1 < len(ldf):
            pairs[oy] = (actual[(oy, 12 * (k + 1))], actual[(oy, 12 * k)] * ldf[k - 1])
    return pairs

ae = {}  # actual over expected, in total and by origin
for year in [2022, 2023, 2024]:
    pairs = backtest(year)
    ae[str(year)] = {"total": sum(a for a, _ in pairs.values()) / sum(f for _, f in pairs.values())}
    ae[str(year)].update({str(oy): a / f for oy, (a, f) in pairs.items()})
ae_cols = ["total"] + cols[1:-1]
(GT(wide({k: [v.get(c, float("nan")) for c in ae_cols] for k, v in ae.items()}, "diagonal", ae_cols),
    rowname_col="diagonal")
 .tab_header("Backtest: actual over expected paid", "By diagonal and accident year")
 .fmt_number(ae_cols, decimals=3)
 .sub_missing(missing_text=""))
```


<style>
#snyyoprxlg 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;
        }

#snyyoprxlg thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#snyyoprxlg p { margin: 0; padding: 0; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #snyyoprxlg .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; }
 #snyyoprxlg .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; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #snyyoprxlg .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; }
 #snyyoprxlg .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; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_column_spanner_outer:first-child { padding-left: 0; }
 #snyyoprxlg .gt_column_spanner_outer:last-child { padding-right: 0; }
 #snyyoprxlg .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%; }
 #snyyoprxlg .gt_spanner_row { border-bottom-style: hidden; }
 #snyyoprxlg .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; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_from_md> :first-child { margin-top: 0; }
 #snyyoprxlg .gt_from_md> :last-child { margin-bottom: 0; }
 #snyyoprxlg .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; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_indent_1 { text-indent: 5px; }
 #snyyoprxlg .gt_indent_2 { text-indent: calc(5px * 2); }
 #snyyoprxlg .gt_indent_3 { text-indent: calc(5px * 3); }
 #snyyoprxlg .gt_indent_4 { text-indent: calc(5px * 4); }
 #snyyoprxlg .gt_indent_5 { text-indent: calc(5px * 5); }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_row_group_first td { border-top-width: 2px; }
 #snyyoprxlg .gt_row_group_first th { border-top-width: 2px; }
 #snyyoprxlg .gt_striped { color: #333333; background-color: #F4F4F4; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #snyyoprxlg .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #snyyoprxlg .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #snyyoprxlg .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #snyyoprxlg .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #snyyoprxlg .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #snyyoprxlg .gt_left { text-align: left; }
 #snyyoprxlg .gt_center { text-align: center; }
 #snyyoprxlg .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #snyyoprxlg .gt_font_normal { font-weight: normal; }
 #snyyoprxlg .gt_font_bold { font-weight: bold; }
 #snyyoprxlg .gt_font_italic { font-style: italic; }
 #snyyoprxlg .gt_super { font-size: 65%; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #snyyoprxlg .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; }
 #snyyoprxlg .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #snyyoprxlg .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #snyyoprxlg .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">Backtest: actual over expected paid</th>
</tr>
<tr class="gt_heading">
<th colspan="7" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">By diagonal and accident year</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="total" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">total</th>
<th id="2019" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2019</th>
<th id="2020" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2020</th>
<th id="2021" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2021</th>
<th id="2022" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2022</th>
<th id="2023" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">2023</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">2022</th>
<td class="gt_row gt_right" headers="stub-1 total">1.008</td>
<td class="gt_row gt_right" headers="stub-1 2019">1.035</td>
<td class="gt_row gt_right" headers="stub-1 2020">1.025</td>
<td class="gt_row gt_right" headers="stub-1 2021">0.951</td>
<td class="gt_row gt_right" headers="stub-1 2022"></td>
<td class="gt_row gt_right" headers="stub-1 2023"></td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">2023</th>
<td class="gt_row gt_right" headers="stub-2 total">1.004</td>
<td class="gt_row gt_right" headers="stub-2 2019">0.977</td>
<td class="gt_row gt_right" headers="stub-2 2020">1.033</td>
<td class="gt_row gt_right" headers="stub-2 2021">1.041</td>
<td class="gt_row gt_right" headers="stub-2 2022">0.962</td>
<td class="gt_row gt_right" headers="stub-2 2023"></td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">2024</th>
<td class="gt_row gt_right" headers="stub-3 total">0.994</td>
<td class="gt_row gt_right" headers="stub-3 2019">1.041</td>
<td class="gt_row gt_right" headers="stub-3 2020">0.994</td>
<td class="gt_row gt_right" headers="stub-3 2021">0.955</td>
<td class="gt_row gt_right" headers="stub-3 2022">1.000</td>
<td class="gt_row gt_right" headers="stub-3 2023">0.974</td>
</tr>
</tbody>
</table>


``` python
fig, ax = plt.subplots()
ax.axhline(1.0, color="0.75")
for year in [2022, 2023, 2024]:
    pairs = backtest(year)
    ax.plot(list(pairs), [a / f for a, f in pairs.values()], marker="o", label=f"diagonal {year}")
ax.set_xticks(years[1:-1])
ax.set_xlabel("accident year")
ax.set_ylabel("actual over expected")
ax.set_title("Backtest: actual over expected paid, by origin")
ax.legend()
```


<figure class="p-figure figure">
<img src="data:image/svg+xml;base64,PHN2ZyB4bGluaz0i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uODM5OTIyIDY5LjcyODEyNSAKTCAzNDYuODM5OTIyIDY5LjcyODEyNSAKIiBzdHlsZT0iZmlsbDogbm9uZTsgc3Ryb2tlOiB2YXIoLS1wLXNlcmllcy0zKTsgc3Ryb2tlLXdpZHRoOiAxLjU7IHN0cm9rZS1saW5lY2FwOiBzcXVhcmUiIC8+CiAgICAgPGc+CiAgICAgIDx1c2UgaHJlZj0iI200NDkzZmRjYTg3IiB4PSIzMzUuODM5OTIyIiB5PSI2OS43MjgxMjUiIHN0eWxlPSJmaWxsOiB2YXIoLS1wLXNlcmllcy0zKTsgc3Ryb2tlOiB2YXIoLS1wLXNlcmllcy0zKSIgLz4KICAgICA8L2c+CiAgICA8L2c+CiAgICA8ZyBpZD0idGV4dF8xNiI+CiAgICAgPHRleHQgc3R5bGU9ImZvbnQtc2l6ZTogMTFweDsgZm9udC1mYW1pbHk6IHZhcigtLXAtZm9udCk7IHRleHQtYW5jaG9yOiBzdGFydDsgZmlsbDogdmFyKC0tcC1pbmspIiB4PSIzNTUuNjM5OTIyIiB5PSI3My41NzgxMjUiIHRyYW5zZm9ybT0icm90YXRlKC0wIDM1NS42Mzk5MjIgNzMuNTc4MTI1KSI+ZGlhZ29uYWwgMjAyNDwvdGV4dD4KICAgIDwvZz4KICAgPC9nPgogIDwvZz4KIDwvZz4KIDxkZWZzPgogIDxjbGlwcGF0aCBpZD0icDBkOTU0ZDhkMDMiPgogICA8cmVjdCB4PSI1My42OTMwNDciIHk9IjIyLjMxODEyNSIgd2lkdGg9IjM5MC42IiBoZWlnaHQ9IjE5OS41ODQiIC8+CiAgPC9jbGlwcGF0aD4KIDwvZGVmcz4KPC9zdmc+" />
</figure>


The totals are within 1% of 1, but the origins show more. In each year the youngest origin (forecast by the 12 to 24 factor) was below its forecast. This is the fall in the newest 12 to 24 ratios of section 1: the first factor is high, which also explains the high 2023 and 2024 loss ratios of section 4. Three diagonals alone are weak evidence, but with the other two checks they support BF or Cape Cod on the two youngest origins.

A BF backtest needs its own loop: it forecasts the next increment of each origin as `prior x (1 / cdf(k + 1) - 1 / cdf(k))`, with the age-to-ultimate factors [cdf](../reference/risk.Gpd.md#prospicio.risk.Gpd.cdf) from the training fit and [k](../reference/models.TargetEncoding.md#prospicio.models.TargetEncoding.k) the current age of the origin.


# 10. From reserve distribution to reinsurance and capital

A reserve distribution is a [PredictiveDistribution](../reference/distributions.PredictiveDistribution.md#prospicio.distributions.PredictiveDistribution), the type that the pricing guides use, so it goes directly into a reinsurance structure.

- **Capital.** `reserves.quantile(0.995)` is the 99.5% reserve, not the capital: the capital is the amount by which it exceeds the mean (or the booked reserve). `reserves.tvar(0.995)` is the tail value at risk. For a one-year standard, the capital is `-cdr.quantile(0.005)`.
- **Adverse development cover (ADC).** A stop-loss layer on the total reserve. [Tower.apply_aggregate](../reference/reinsurance.Tower.md#prospicio.reinsurance.Tower.apply_aggregate) treats the total of each simulation as one loss and applies the layer to it.
- **Loss portfolio transfer (LPT).** A quota share of the full reserve.


``` python
from prospicio.reinsurance import Layer, Tower

adc = Tower([Layer.stop_loss("ADC", 300.0, 1700.0)]).apply_aggregate(mb.reserves)
by_kind = adc.aggregate(["kind"])
gross, ceded, net = (by_kind.marginal((k,)) for k in ["gross", "ceded", "net"])
print(f"ADC pays on average {ceded.mean():.1f}, attaches in {1 - ceded.cdf(0.0):.1%} of simulations")
lpt = Tower([Layer.quota_share("LPT", 1.0)]).apply_aggregate(mb.reserves)
print(f"gross 99.5% tail value at risk {mb.reserves.tvar(0.995):.0f}")
print("LPT cedes", round(lpt.aggregate(["kind"]).marginal(("ceded",)).mean()))
print(f"one-year 99.5% loss, -cdr.quantile(0.005): {-mack_1y.cdr.quantile(0.005):.0f}")
```


    ADC pays on average 17.7, attaches in 18.7% of simulations
    gross 99.5% tail value at risk 2019
    LPT cedes 1541
    one-year 99.5% loss, -cdr.quantile(0.005): 326


``` python
views = pd.DataFrame(
    [(k, d.mean(), d.quantile(0.995), d.quantile(0.995) - d.mean() if k != "ceded" else None)
     for k, d in [("gross", gross), ("ceded", ceded), ("net", net)]],
    columns=["view", "mean", "99.5%", "capital"],
)
(GT(views, rowname_col="view")
 .tab_header("Lifetime reserve with the ADC 300 xs 1,700", "Capital: the 99.5% less the mean")
 .fmt_number("mean", decimals=1)
 .fmt_number(["99.5%", "capital"], decimals=0)
 .sub_missing(missing_text=""))
```


<style>
#wvkorrjyhr 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;
        }

#wvkorrjyhr thead, tbody, tfoot, tr, td, th { border-style: none; }
 tr { background-color: transparent; }
#wvkorrjyhr p { margin: 0; padding: 0; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_caption { padding-top: 4px; padding-bottom: 4px; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_column_spanner_outer:first-child { padding-left: 0; }
 #wvkorrjyhr .gt_column_spanner_outer:last-child { padding-right: 0; }
 #wvkorrjyhr .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%; }
 #wvkorrjyhr .gt_spanner_row { border-bottom-style: hidden; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_from_md> :first-child { margin-top: 0; }
 #wvkorrjyhr .gt_from_md> :last-child { margin-bottom: 0; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_indent_1 { text-indent: 5px; }
 #wvkorrjyhr .gt_indent_2 { text-indent: calc(5px * 2); }
 #wvkorrjyhr .gt_indent_3 { text-indent: calc(5px * 3); }
 #wvkorrjyhr .gt_indent_4 { text-indent: calc(5px * 4); }
 #wvkorrjyhr .gt_indent_5 { text-indent: calc(5px * 5); }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_row_group_first td { border-top-width: 2px; }
 #wvkorrjyhr .gt_row_group_first th { border-top-width: 2px; }
 #wvkorrjyhr .gt_striped { color: #333333; background-color: #F4F4F4; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #wvkorrjyhr .gt_first_summary_row { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; }
 #wvkorrjyhr .gt_last_summary_row_top { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }
 #wvkorrjyhr .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }
 #wvkorrjyhr .gt_first_grand_summary_row_bottom { border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; }
 #wvkorrjyhr .gt_last_grand_summary_row_top { border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #wvkorrjyhr .gt_left { text-align: left; }
 #wvkorrjyhr .gt_center { text-align: center; }
 #wvkorrjyhr .gt_right { text-align: right; font-variant-numeric: tabular-nums; }
 #wvkorrjyhr .gt_font_normal { font-weight: normal; }
 #wvkorrjyhr .gt_font_bold { font-weight: bold; }
 #wvkorrjyhr .gt_font_italic { font-style: italic; }
 #wvkorrjyhr .gt_super { font-size: 65%; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }
 #wvkorrjyhr .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; }
 #wvkorrjyhr .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; text-align: left; }
 #wvkorrjyhr .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }
 #wvkorrjyhr .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">Lifetime reserve with the ADC 300 xs 1,700</th>
</tr>
<tr class="gt_heading">
<th colspan="4" id="subtitle" class="gt_heading gt_subtitle gt_font_normal gt_bottom_border">Capital: the 99.5% less the mean</th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"></th>
<th id="mean" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">mean</th>
<th id="99.5" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">99.5%</th>
<th id="capital" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col">capital</th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<th id="stub-1" class="gt_row gt_left gt_stub" scope="row">gross</th>
<td class="gt_row gt_right" headers="stub-1 mean">1,541.3</td>
<td class="gt_row gt_right" headers="stub-1 99.5">1,981</td>
<td class="gt_row gt_right" headers="stub-1 capital">440</td>
</tr>
<tr>
<th id="stub-2" class="gt_row gt_left gt_stub" scope="row">ceded</th>
<td class="gt_row gt_right" headers="stub-2 mean">17.7</td>
<td class="gt_row gt_right" headers="stub-2 99.5">281</td>
<td class="gt_row gt_right" headers="stub-2 capital"></td>
</tr>
<tr>
<th id="stub-3" class="gt_row gt_left gt_stub" scope="row">net</th>
<td class="gt_row gt_right" headers="stub-3 mean">1,523.7</td>
<td class="gt_row gt_right" headers="stub-3 99.5">1,700</td>
<td class="gt_row gt_right" headers="stub-3 capital">176</td>
</tr>
</tbody>
</table>


The ADC caps the net 99.5% at 1,700 and cuts the lifetime capital from 440 to 176. Over one year the same reserve's 99.5% loss is 326 (section 7), and its one-year capital, that loss less the expected loss, is 325 (section 11). These figures are undiscounted and exclude unallocated loss adjustment expenses; section 11 discounts the reserve and adds an IFRS 17 risk adjustment, and the price of a cover discounts as below.

The LPT cedes all 1,541 on average. Its price starts from that mean, adds a load for the risk and subtracts a discount for the time to pay. Use `prospicio.pricing` for both:

1.  `price(ceded, Distortion.tvar(0.995), cost_of_capital=...)` on the ceded marginal of the LPT gives a one-period price ([Distortion](../reference/risk.Distortion.md#prospicio.risk.Distortion) is in `prospicio.risk`).
2.  `price_over_payout(that_price, pattern, rate=..., cost_of_capital=...)` gives the price over a payment pattern: it discounts the losses and charges the cost of capital (a spread over the discount rate) on the capital, which falls with the share of the loss still unpaid. Give it the same cost of capital or distortion as step 1.

A reserve on the books needs its run-off pattern from the valuation date, not the pattern of a new origin. Make it from the paid chain ladder: for each calendar year `j` after the valuation, add the expected payments of all origins, `ultimate x (1 / cdf(k + j) - 1 / cdf(k + j - 1))` (`cdf(k)` is the factor at the current age of the origin), divide by the total reserve, and give the times `1, 2, ...` and these shares to `PaymentPattern(times, shares)`. `PaymentPattern.from_development([age / 12 for age in tri.development], cl.cdf)` gives instead the pattern of a new accident year from its start (the last factor must be 1), for a prospective cover. [`reinsurance-price.md`](reinsurance-price.md) gives an example on a layer, and the time value bullet in [`risk-loads-and-distortions.md`](risk-loads-and-distortions.md) explains the calculation over the payout.

To price the cover, add a load for the reinsurer's risk ([`risk-loads-and-distortions.md`](risk-loads-and-distortions.md); [`reinsurance-price.md`](reinsurance-price.md) shows the parts of a price). The expected loss of an ADC is sensitive to the tail of the reserve distribution: the bootstrap [tail](../reference/reserving.Mack.md#prospicio.reserving.Mack.tail) and the choice of Mack's or the ODP's process change it.


# 11. Discounted reserves and the IFRS 17 risk adjustment

Under IFRS 17 the liability for incurred claims is the present value of the unpaid claims plus a risk adjustment for non-financial risk, and an entity discloses the confidence level that its risk adjustment corresponds to (para. 119, as the design note `docs/design/reserving-ifrs17.md` reads it; the paragraph texts have not been checked here against the standard). Every stochastic fit of section 6 has [discounted](../reference/reserving.MackFit.md#prospicio.reserving.MackFit.discounted), which discounts each simulation's unpaid claims from the valuation date along its own payment timing, by origin and in total.

- **The basis is stated.** `basis="paid"` pays each simulation's reserve along that simulation's own development pattern, so the fit must be on paid claims. For a fit on incurred claims give `basis="incurred"` with `paid_pattern=` (the cumulative paid share at each age) and `latest_paid=` (each origin's latest paid): the amount discounted is then the IBNR plus each origin's case reserve. There is no default, so an incurred fit is not discounted by its reporting pattern by mistake.
- **The curve.** `rate=` is a flat annual effective rate; `curve=DiscountCurve( maturities, rates)` gives spot rates by maturity in years, linear between them and flat outside.
- **The timing.** Payments fall at the middle of each development period by default (`timing="mid"`), or at its end (`timing="end"`).


``` python
from prospicio.reserving import DiscountCurve

flat = mb.discounted(basis="paid", rate=0.03)
end = mb.discounted(basis="paid", rate=0.03, timing="end")
spot = mb.discounted(basis="paid", curve=DiscountCurve([1.0, 5.0, 10.0], [0.02, 0.03, 0.035]))
print(f"undiscounted mean {mb.reserves.mean():.0f}")
for label, d in [("3% mid-period", flat), ("3% end of period", end), ("spot curve", spot)]:
    print(f"{label:17} best estimate {d.best_estimate:.0f}  99.5% {d.discounted.quantile(0.995):.0f}")
print("discount factor by origin:", [round(f, 3) for f in flat.discount_factors])
```


    undiscounted mean 1541
    3% mid-period     best estimate 1472  99.5% 1882
    3% end of period  best estimate 1450  99.5% 1855
    spot curve        best estimate 1486  99.5% 1900
    discount factor by origin: [1.0, 0.985, 0.976, 0.969, 0.962, 0.956, 0.948]


Each simulation is discounted on its own timing and the origins are then summed, so the 99.5% of the discounted total is read from the discounted draws, not by scaling the undiscounted 99.5%. The oldest origins pay sooner and are discounted less. Payments at the end of each period are half a period later than at the middle, so they are discounted more.

**The risk adjustment.** [risk_adjustment](../reference/reserving.DiscountedReserves.md#prospicio.reserving.DiscountedReserves.risk_adjustment) reads it off the discounted total `X`, whose mean is the best estimate `BE`, by a confidence level (`Q_p(X) - BE`), by TVaR (`TVaR_p(X) - BE`) or by a cost of capital: a rate times the capital held in each future year, discounted, the capital running off with the best estimate (`flat.runoff`). Each result gives [implied_confidence](../reference/reserving.RiskAdjustmentResult.md#prospicio.reserving.RiskAdjustmentResult.implied_confidence), the share of the discounted draws at or below `BE` plus the risk adjustment, which is the confidence level that para. 119 asks an entity to disclose. The cost of capital needs the capital at the valuation date (there is no default): a VaR or TVaR level of `X`, or an amount. It is charged at the end of each year by default, as Solvency II's risk margin is; `charge="start"` charges it at the start, as [price_over_payout](../reference/pricing.price_over_payout.md#prospicio.pricing.price_over_payout) does.


``` python
methods = [
    ("75% confidence level", flat.risk_adjustment("confidence", 0.75)),
    ("TVaR 75%", flat.risk_adjustment("tvar", 0.75)),
    ("6% cost of capital, lifetime 99.5%", flat.risk_adjustment("cost_of_capital", rate=0.06, capital=("var", 0.995))),
]
for label, ra in methods:
    print(f"{label:36} {ra.amount:5.0f}  implied confidence {ra.implied_confidence:.1%}")
```


    75% confidence level                   111  implied confidence 75.0%
    TVaR 75%                               210  implied confidence 89.9%
    6% cost of capital, lifetime 99.5%      49  implied confidence 61.7%


**The one-year view as the capital.** Solvency II's reserve risk is the one-year view of section 7: the claims development result (CDR) is the opening ultimate less the ultimate a year later, so an adverse year is a negative CDR and the 99.5% loss is `-cdr.quantile(0.005)`. The capital above the expected loss is that less the expected loss, `-cdr.mean()`, so `cdr.mean() - cdr.quantile(0.005)`. It can be brought to the cost of capital as an amount, which is how a risk margin in the manner of Solvency II's is built on the lifetime run-off (an approximation in the spirit of EIOPA's proportional run-off simplification, not a full Solvency II calculation: it runs on the one segment's reserve risk alone, at this curve).


``` python
one_year_capital = mack_1y.cdr.mean() - mack_1y.cdr.quantile(0.005)
margin = flat.risk_adjustment("cost_of_capital", rate=0.06, capital=one_year_capital)
print(f"one-year capital {one_year_capital:.0f}, cost-of-capital risk adjustment {margin.amount:.0f}")
print(f"implied confidence {margin.implied_confidence:.1%}")
```


    one-year capital 325, cost-of-capital risk adjustment 39
    implied confidence 59.3%


Which method and which level to use is the entity's choice under IFRS 17, which prescribes neither; state the method, the level and the implied confidence level together. Here the 75% confidence level adds 111 to the best estimate of 1,472, TVaR 75% adds 210 (an implied confidence level of 89.9%), and a 6% cost of capital on the lifetime 99.5% capital adds 49 (61.7%). On the one-year capital of 325 (the 326 of section 7 less the expected loss of 1.2) it adds 39, a 59.3% confidence level: the one-year capital is smaller than the lifetime one, so the margin is too.


# See also

- [`ifrs17-measurement.md`](ifrs17-measurement.md): the group of contracts that the LIC belongs to, its CSM and loss component, period by period
- [`choosing-a-method.md`](choosing-a-method.md): how to select from all the methods in prospicio
- [`risk-loads-and-distortions.md`](risk-loads-and-distortions.md): a load on an expected loss for risk
- [`experience-and-exposure-rating.md`](experience-and-exposure-rating.md): pricing from loss history and from exposure
- [`aggregate-distributions.md`](aggregate-distributions.md): the distribution of the annual total
- [`severity-and-frequency.md`](severity-and-frequency.md): fitting the size and the number of losses
- [`reinsurance-price.md`](reinsurance-price.md): what a reinsurance price is
