# Marginal pricing

> Pricing a contract against the portfolio Caldera Re already writes: marginal capital, marginal technical premium, the return at each participation, and why the result depends on the trials the contract pays in.

Source: https://reinsurance.dev/applications/marginal-pricing/

## The business problem

Trident Re, a Caribbean insurer, is buying protection for its hurricane book of business: a \$20M xs \$10M [catastrophe excess of loss (CatXoL)](https://reinsurance.dev/financial-modelling/contracts/catxol/) layer with one reinstatement at 100%, charged pro rata to the amount and to the time left in the year, at a proposed premium of \$6M for the whole layer. The broker offers **Caldera Re** a 20% [participation](https://reinsurance.dev/glossary/#participation), \$1.20M of that premium. This is Contract 7 (C7) in the [Caldera Re appendix](https://reinsurance.dev/caldera-re/), the one contract the portfolio does not yet include. The question the underwriter asks here is:

> How much additional capital does C7 consume in the portfolio Caldera Re **already writes**, and what premium covers its cost?

This is a different question from the one the underwriter asked in [standalone pricing](https://reinsurance.dev/applications/standalone-pricing/). Standalone pricing charged a program for the capital it would require on its own. However, Caldera Re does not write contracts on their own: it writes [six of them](https://reinsurance.dev/applications/portfolio-analytics/#step-1-select-the-constituents), capitalised together, and a new participation changes the capital the portfolio requires by an amount the contract's own distribution does not determine. **[Marginal pricing](https://reinsurance.dev/glossary/#marginal-pricing)** prices that change. It answers the question an underwriter needs answered before quoting: at what price does this participation pay for the capital it consumes?

:::note[In Practice]
Pricing a contract by the additional capital it requires on top of the reinsurer's existing portfolio goes back to Kreps's marginal-surplus method, and by the early 2000s it was described as a de facto industry standard, in its standard-deviation form.[^marginal-practice] Kreps treats the standalone price as a reasonable maximum, because contracts written together do not all lose in the same trials. In this site's assessment, the gap between the two is a margin the reinsurer can pass on to the cedent to compete for the contract, or keep when the market will bear the higher price. This site measures the marginal capital with Tail Value at Risk (TVaR) less expected loss, the capital measure the other stories use.
:::

Every figure on this page includes the reinstatement premium each contract earns, as [standalone pricing](https://reinsurance.dev/applications/standalone-pricing/#step-4-reinstatement-premium-in-the-price) does from its Step 4 on.

## The pipeline

Marginal pricing reuses the stages of [standalone pricing](https://reinsurance.dev/applications/standalone-pricing/) and [portfolio analytics](https://reinsurance.dev/applications/portfolio-analytics/) and adds one subtraction. The portfolio's per-trial outcome comes from the [roll-up](https://reinsurance.dev/applications/portfolio-analytics/#step-2-roll-it-up); the candidate's comes from its composition; the required capital comes from the same $K = \text{TVaR}_\alpha - \text{EL}$ as everywhere on the site, computed twice:

```mermaid
graph TB
    B[Portfolio outcome<br/>six contracts, net of reinstatement premium]:::Metric --> W[Portfolio plus candidate<br/>per-trial sum]:::Process
    Y[Trident Re's YELT]:::Losses --> C[C7 composition<br/>$20M xs $10M, 1 reinstatement]:::Contract
    C --> X[C7 outcome at the 20% participation<br/>net of reinstatement premium]:::Contract
    X --> W
    B --> D[Marginal capital<br/>K with minus K without]:::Metric
    W --> D
    D --> P[Marginal technical premium<br/>vs standalone, vs proposed]:::Neutral
    D --> R[Return on the capital<br/>at the proposed premium, by participation]:::Neutral

    classDef Losses fill:#F5CEBC,stroke:#B16C4B,stroke-width:1.5px,color:#2B2620
    classDef Contract fill:#BFDBF8,stroke:#4F84BA,stroke-width:1.5px,color:#2B2620
    classDef Process fill:#F7CBCB,stroke:#B46669,stroke-width:1.5px,color:#2B2620
    classDef Metric fill:#BDE2CB,stroke:#459269,stroke-width:1.5px,color:#2B2620
    classDef Neutral fill:#E7E0D9,stroke:#97918A,stroke-width:1.5px,color:#2B2620
```

The portfolio's outcome is computed once and kept. Each candidate adds one array of $N$ values to it, and the required capital is recomputed on the sum. The candidate's [standalone price](https://reinsurance.dev/applications/marginal-pricing/#step-1-the-candidate-on-its-own) is the benchmark the marginal price is compared with.

## Step 1: the candidate on its own

C7 is a composition like any other CatXoL:

$$
\text{agg}_{\text{excess}}(0, 40\text{M}) \circ \text{occ}_{\text{excess}}(10\text{M}, 20\text{M}) \circ \text{period}(t_0, t_1) \circ \text{filter}(\text{TridentRe}, \text{HU})
$$

applied right to left: the filter first, the aggregate excess last. Across the 20 trials of the [demo tier](https://reinsurance.dev/toolkit/trials/#demo-scale) it pays in 6, and in five of those a single storm uses the full \$20M limit. Its expected loss for the whole layer is \$5.74M, compared with a \$6M premium.

Priced alone by the standalone method, with the [reinstatement premium](https://reinsurance.dev/financial-modelling/beyond-loss/reinstatement-premium/) counted, C7's technical premium is \$6.75M for the whole layer, above the \$6M proposal. Charged pro rata to time, a restoration after an August to October storm costs Trident Re about 40% of the premium or less, so C7's reinstatement premium is small.

A technical premium is quoted for the whole layer, at 100%, whatever Caldera Re's participation: the participation pays its share of it. To compare it with the proposal, this site uses the **[price adequacy](https://reinsurance.dev/glossary/#price-adequacy)**, the proposed premium divided by the technical premium. Above 100%, the proposed premium covers the cost; below 100%, it does not. The standalone adequacy is the same at every participation; the marginal adequacy is not, as [Step 4](https://reinsurance.dev/applications/marginal-pricing/#step-4-the-marginal-technical-premium) explains.

| C7, whole layer | Premium | Price adequacy of the \$6M proposal |
| --- | ---: | ---: |
| Standalone technical premium | \$6.75M | 88.9% |
| Proposed premium | \$6M | |

On its own, C7 is underpriced by \$0.75M, and an underwriter who considers only the contract declines it. At the 20% participation, the capital C7 would require on its own is \$2.67M: [TVaR](https://reinsurance.dev/glossary/#tvar-tail-value-at-risk) at 90% less expected loss, of Caldera Re's share of C7's outcome net of reinstatement premium. The marginal capital is compared against that figure, starting from [the portfolio C7 would join](https://reinsurance.dev/applications/marginal-pricing/#step-2-the-portfolio-it-joins).

## Step 2: the portfolio it joins

The portfolio consists of the six base contracts at Caldera Re's participations, and [Portfolio analytics](https://reinsurance.dev/applications/portfolio-analytics/) rolls up their outcomes. Each contract's gross loss is taken net of the reinstatement premium it earns on its premium (C1, C4 and C6 have reinstatements), so the portfolio outcome per trial is

$$
B_j = \sum_{i=1}^{6} p_i \cdot \left( L_{i,j}^{\text{gross}} - \mathcal{R}^{(i)}_{j} \right)
$$

where $p_i$ is the participation and $\mathcal{R}^{(i)}_{j}$ contract $i$'s reinstatement premium in trial $j$. $B_j$ is an outcome, not a loss: the reinstatement premium can exceed a contract's gross in a trial, and the sum is then smaller than the losses in it.

| Portfolio, 20 trials, net of reinstatement premium | |
| --- | ---: |
| Expected outcome (EL) | \$11.35M |
| TVaR(90%) | \$18.60M |
| Required capital $K$ | \$7.25M |

On losses alone, [Portfolio analytics](https://reinsurance.dev/applications/portfolio-analytics/#step-5-risk-versus-opportunity) measures \$8.92M; net of reinstatement premium the required capital is \$7.25M. At 20 trials, TVaR(90%) is the average of the two largest outcomes, so the trials near the top of the ranking determine what a new contract changes. A trial has no property that places it in the tail other than the size of its outcome: sorting the outcomes selects which trials TVaR averages.

| Trial | What happens in it | Portfolio outcome | C7 at 20% | Portfolio with C7 |
| ---: | --- | ---: | ---: | ---: |
| 9 | Heavy European windstorm losses, Florida hurricanes that exhaust C1's aggregate limit, and no Caribbean hurricane that reaches C7's layer | \$19.76M | – | \$19.76M |
| 2 | Losses on all six contracts; no Caribbean hurricane reaches C7's layer | \$17.44M | – | \$17.44M |
| 3 | Losses on five of the six contracts, and a Caribbean hurricane that uses C7's full limit | \$16.58M | \$3.57M | \$20.15M |
| 5 | Heavy European windstorm losses, and a Caribbean hurricane that uses C7's full limit | \$14.48M | \$3.65M | \$18.13M |

The C7 column is Caldera Re's 20% of C7's loss, net of the reinstatement premium it earns. Trial 3 has the largest outcome below the tail, close enough that a full-limit C7 loss moves the trial to the top when [C7 is added](https://reinsurance.dev/applications/marginal-pricing/#step-3-add-the-candidate).

## Step 3: add the candidate

Adding C7 at the 20% participation to the portfolio means adding its outcome trial by trial, $B_j + X_j$ with $X_j = 0.2 \cdot (L_{7,j}^{\text{gross}} - \mathcal{R}^{(7)}_{j})$, and recomputing the required capital. The **[marginal capital](https://reinsurance.dev/glossary/#marginal-impact)** is the difference:

$$
\Delta K = K(B + X) - K(B) = \Delta\text{TVaR}_\alpha(X) - \text{EL}(X)
$$

In words: the increase in the portfolio's TVaR with the contract, less the contract's expected outcome, which its premium covers. Here $\text{EL}(X)$ is the mean of the outcome $X$, expected loss less expected reinstatement premium.

:::note[In Practice]
Marginal capital is also defined as the change in TVaR, $\text{TVaR}(B + X) - \text{TVaR}(B)$.[^marginal-total] With capital defined as TVaR less expected loss, the two differ by the contract's expected outcome. Expected loss adds across contracts, $\text{EL}(B + X) = \text{EL}(B) + \text{EL}(X)$, so

$$
\begin{aligned}
\Delta K &= \left[\text{TVaR}_\alpha(B + X) - \text{EL}(B + X)\right] - \left[\text{TVaR}_\alpha(B) - \text{EL}(B)\right] \\
&= \left[\text{TVaR}_\alpha(B + X) - \text{TVaR}_\alpha(B)\right] - \left[\text{EL}(B + X) - \text{EL}(B)\right] \\
&= \Delta\text{TVaR}_\alpha(X) - \text{EL}(X)
\end{aligned}
$$

Which definition applies follows from the capital measure. A reinsurer that holds capital for the whole tail, $K = \text{TVaR}_\alpha$, charges for $\Delta\text{TVaR}$. This site's $K = \text{TVaR}_\alpha - \text{EL}$ treats the expected loss as funded by the premium, so the pricing equation in [Step 4](https://reinsurance.dev/applications/marginal-pricing/#step-4-the-marginal-technical-premium) charges the cost of capital only on the capital above the expected outcome. Charging it on $\Delta\text{TVaR}$ would add $r_c \cdot \text{EL}(X)$ to the income the participation must earn. For C7 the two differ by \$1.04M: a \$1.35M change in TVaR compared with a \$0.31M marginal capital.
:::

| C7 at a 20% participation | Standalone | Marginal |
| --- | ---: | ---: |
| Expected loss, Caldera Re's share | \$1.15M | \$1.15M |
| Expected reinstatement premium | \$0.11M | \$0.11M |
| Expected outcome, $\text{EL}(X)$ | \$1.04M | \$1.04M |
| TVaR(90%) | \$3.71M | $\Delta\text{TVaR}$: \$1.35M |
| Required capital | $K$: \$2.67M | $\Delta K$: \$0.31M |

Added to the portfolio, C7 requires \$0.31M of additional capital, only 12% of the \$2.67M it requires alone. In this data the whole increase in the tail comes from Trial 3, with losses on most contracts and a Caribbean hurricane: C7's \$3.57M full-limit loss moves Trial 3 from slightly below the tail to the top of it, and Trial 2 drops out. C7 pays nothing in Trials 9 and 2, the two trials that set the capital the portfolio requires before C7 joins, because in neither does a Caribbean hurricane reach its layer. Its other full-limit trials stay below the new tail; Trial 5 comes closest, at \$18.13M compared with \$20.15M and \$19.76M.

:::tip[Key Insight]
**Marginal capital never exceeds standalone capital** when capital is TVaR less expected loss. TVaR is sub-additive, $\text{TVaR}_\alpha(B + X) \le \text{TVaR}_\alpha(B) + \text{TVaR}_\alpha(X)$ ([sub-additivity](https://reinsurance.dev/glossary/#sub-additivity), with both tails taken at the same $\alpha$ over the same trials),[^subadditive] and expected loss adds, so $\Delta K \le K(X)$ for every contract and every portfolio. Tail dependence can increase the marginal capital up to the standalone capital, when the contract pays most in exactly the portfolio's worst trials, and no further. A marginal figure above the standalone one is a bug, or a sign that the capital measure is not TVaR: [Value at Risk (VaR)](https://reinsurance.dev/glossary/#var-value-at-risk) is not sub-additive and gives no such bound.
:::

Tracing the result to individual trials in this way is possible only because the demo tail contains two of them. At production scale the tail contains thousands of trials, and $\Delta K$ is an average over all of them, computed rather than traced ([At production scale](https://reinsurance.dev/applications/marginal-pricing/#at-production-scale)).

Caribbean and Florida hurricanes come from the same storm catalog in the demo data, and 23 Trident Re occurrences share an event with a SunCoast one, yet none of C7's full-limit trials is one of the two trials that set the capital the portfolio requires. The region of a contract does not predict its marginal capital. The marginal capital depends on how much the contract loses in the trials that make up the portfolio's tail. The marginal capital becomes a price through the same [pricing equation](https://reinsurance.dev/applications/marginal-pricing/#step-4-the-marginal-technical-premium) as in standalone pricing.

## Step 4: the marginal technical premium

The marginal technical premium is the premium for the whole layer at which Caldera Re's participation covers its share of the expected loss, the expense load, and the cost of the capital it requires. Like the standalone technical premium, it is a reference price, not a premium anyone pays: the market sets the premium, and the technical premium is what that premium is compared with. The comparison distinguishes an underpriced proposal from an adequately priced or overpriced one, and a price above the technical premium earns [a return above the cost of capital](https://reinsurance.dev/applications/marginal-pricing/#step-5-the-return-on-the-capital). With the reinstatement premium in the income, for a participation $s$:

$$
s \cdot \mathcal{P} \cdot (1 + \bar u) = (1 + \epsilon) \cdot s \cdot \text{EL}_7 + r_c \cdot \Delta K(\mathcal{P})
$$

Here $\mathcal{P}$ is the premium for the whole layer, $\text{EL}_7$ is C7's gross expected loss for the whole layer, \$5.74M, and $\bar u$ the expected reinstatement premium per unit of premium. $\Delta K$ depends on $\mathcal{P}$ because the reinstatement premium in C7's tail trials scales with it, so the equation is solved by the same fixed-point loop as the [standalone price with reinstatement premium](https://reinsurance.dev/applications/standalone-pricing/#step-4-reinstatement-premium-in-the-price). $\Delta K$ also depends on $s$, so the marginal technical premium does too: it is the price for the whole layer at which this participation, and no other, earns its cost of capital. At the site's $\alpha = 90\%$, $r_c = 10\%$ and $\epsilon = 5\%$:

| C7 at a 20% participation | Technical premium, whole layer | Price adequacy of the \$6M proposal |
| --- | ---: | ---: |
| Standalone | \$6.75M | 88.9% |
| Marginal | **\$5.68M** | **105.6%** |

The \$5.68M is the lowest premium at which a 20% participation in C7 earns Caldera Re's 10% cost of capital, given the portfolio it writes. It is below C7's \$5.74M expected loss and covers C7's costs only because \$0.51M of expected reinstatement premium comes with it. The proposed \$6M is \$0.32M above it.

The two views disagree. Standalone, the \$6M proposal is \$0.75M short of C7's \$6.75M technical premium. Against the portfolio, the proposal clears the \$5.68M marginal technical premium, and the underwriter accepts the 20% participation.

:::tip[Key Insight]
**The marginal technical premium is the reinsurer's floor in a negotiation.** Caldera Re can accept a price for the layer as low as \$5.68M and still earn its cost of capital on the participation, \$1.07M below the \$6.75M standalone price. The gap between the two is the room to compete: a reinsurer that prices against its portfolio can quote below a competitor that prices the contract alone, and still be paid for the capital the contract consumes. A different portfolio gives a different floor, so two reinsurers can quote different prices for the same layer and both be right.
:::

The code computes the portfolio's outcome, C7's marginal capital, both technical premiums, and the return at the proposed premium for each participation:

Python (`python/caldera_re/marginal_pricing.py`, runnable on the web page):

```python
"""Marginal pricing: the additional capital a new contract consumes.

Standalone pricing charges a contract for the capital it would require alone,
K = Tail Value at Risk (TVaR) - expected loss (EL) of its own outcome. A reinsurer that already writes a portfolio
needs only the additional capital the portfolio requires with the contract:

    Delta K = K(portfolio + X) - K(portfolio)

with every outcome taken net of the reinstatement premium it earns
(reinstatement_pricing.py).

Because EL adds, Delta K is the change in TVaR less the contract's own
expected outcome:

    Delta K = [TVaR(B + X) - EL(B + X)] - [TVaR(B) - EL(B)]
            = [TVaR(B + X) - TVaR(B)] - [EL(B + X) - EL(B)]
            = Delta TVaR - EL(X)

The marginal technical premium is the premium, at 100% of the layer, at which
Caldera Re's participation s covers its share of the expected loss, the
expense load and the cost of the capital required for it:

    s * P * (1 + mean(u)) = (1 + epsilon) * s * EL + r_c * Delta K(P)

Delta K depends on P through the reinstatement premium in the tail, so it is
solved by the same fixed-point loop as the standalone price. Delta K also
depends on s, so the marginal technical premium does too. The offered premium
divided by a technical premium is the price adequacy: above 100% the price
covers the cost. The standalone adequacy is the same at every s; the marginal
one changes with s.

Delta K <= K(x), x = s * (gross - P * u), always: TVaR is sub-additive (over
the same trials, at the same alpha) and EL adds, so a contract never requires
more capital as part of the portfolio than it would alone.

At a quoted premium the question is the return. The contract's margin,
premium plus expected reinstatement premium less expected loss and expenses,
is divided by one of three capitals:

    RAROC standalone = margin / K(x)
    RAROC marginal   = margin / Delta K       (no meaning when Delta K <= 0)
    RAROC portfolio  = (portfolio margin + margin) / K(portfolio + x)

Standalone, the margin and K(x) both scale with the participation, so the
return does not depend on it. Against the portfolio, the return varies with the
participation.
"""

import numpy as np

from caldera_re.catxol import catxol
from caldera_re.data import cedents
from caldera_re.portfolio_analytics import (
    PREMIUM_100, PROPOSED_C7, REINSTATEMENTS, premium_book)
from caldera_re.portfolio_rollup import CONTRACTS, contract_gross
from caldera_re.reinstatement_premium import (
    per_trial, reinstatement_factor, reinstatement_premium)
from caldera_re.reinstatement_pricing import (
    EPSILON, R_C, capital, outcome_tvar, price_with_reinstatement)
from caldera_re.report import fields, heading, table
from caldera_re.utils import all_trials, trial_count

# C7, proposed: Trident Re's Caribbean hurricane CatXoL, $20M xs $10M, one
# reinstatement at 100%, pro rata to amount and to time, $6M proposed premium
# at 100%, offered to Caldera Re at a 20% participation.
C7_LIMIT = 20.0
C7_PREMIUM = PROPOSED_C7
C7_SHARE = 0.20

def _c7_gross_yelt(yelt=None):
    """C7's ceded rows at 100%, in claims order, one row per occurrence."""
    yelt = cedents.trident if yelt is None else yelt
    return catxol(yelt, attachment=10.0, limit=C7_LIMIT, reinstatements=1,
                  peril='HU')

def c7_gross(yelt=None) -> np.ndarray:
    """C7's ceded loss at 100%, one value per trial."""
    rows = _c7_gross_yelt(yelt)
    per = rows.groupby('trial_id')['gross_loss'].sum()
    return all_trials(per, trial_count(rows)).to_numpy()

def c7_factor(yelt=None) -> np.ndarray:
    """C7's reinstatement premium per unit of premium, per trial. Its clause
    is pro rata to time, so this needs the occurrence dates: the premium-1
    run of the term, not the trial-level shortcut."""
    rows = _c7_gross_yelt(yelt)
    return per_trial(reinstatement_premium(rows, 1.0, C7_LIMIT, 1,
                                           pro_rata_time=True))

def factor(contract: str, gross: np.ndarray) -> np.ndarray:
    """Reinstatement premium per unit of premium, per trial (0 without one),
    for a base contract whose clause is pro rata to amount only."""
    if contract not in REINSTATEMENTS:
        return np.zeros_like(gross)
    limit, n, rate = REINSTATEMENTS[contract]
    return reinstatement_factor(gross, limit, n, rate)

def portfolio_outcome(gross: dict) -> np.ndarray:
    """The portfolio's outcome per trial: participated gross net of the
    reinstatement premium each contract earns on its premium."""
    return sum(CONTRACTS[c]['participation']
               * (gross[c] - PREMIUM_100[c] * factor(c, gross[c]))
               for c in CONTRACTS)

def portfolio_margin(gross: dict) -> float:
    """The portfolio's margin at its booked premiums: premium plus expected
    reinstatement premium, less expected loss and expenses. The expected
    reinstatement premium is the participated expected loss less the expected
    outcome."""
    el = sum(CONTRACTS[c]['participation'] * gross[c].mean() for c in CONTRACTS)
    rip = el - portfolio_outcome(gross).mean()
    return premium_book()['total'] + rip - (1 + EPSILON) * el

def marginal(base: np.ndarray, gross: np.ndarray, u: np.ndarray,
             share: float, premium: float | None = None) -> dict:
    """Marginal capital and marginal technical premium of `share` of a layer.

    `gross` is the layer's ceded loss at 100% per trial, and `u` its
    reinstatement premium per unit of premium per trial (zeros without a
    paid reinstatement). `premium` (at 100%) sets the reinstatement premium
    in the reported Delta K; the marginal technical premium is solved for,
    with the reinstatement premium on it.
    """
    el = gross.mean()
    k_base = capital(base)

    def delta_k(p):
        return capital(base + share * (gross - p * u)) - k_base

    p = (1 + EPSILON) * el + R_C * delta_k(0.0) / share   # before reinstatement premium
    for _ in range(100):
        p_next = ((1 + EPSILON) * share * el + R_C * delta_k(p)) / (share * (1 + u.mean()))
        if abs(p_next - p) < 1e-10:
            break
        p = p_next
    quoted = p_next if premium is None else premium
    x = share * (gross - quoted * u)
    return {
        'el': share * el,
        'reinstatement_premium': share * quoted * u.mean(),
        'delta_tvar': outcome_tvar(base + x) - outcome_tvar(base),
        'delta_k': capital(base + x) - k_base,
        'standalone_k': capital(x),
        'technical': p_next,
    }

def returns(base: np.ndarray, base_margin: float, gross: np.ndarray,
            u: np.ndarray, share: float, premium: float) -> dict:
    """RAROC of `share` of a layer at `premium` (at 100%): one margin over
    three capitals: the capital the contract requires alone, the additional
    capital the portfolio requires with it, and the capital the portfolio
    requires with it."""
    margin = share * (premium * (1 + u.mean()) - (1 + EPSILON) * gross.mean())
    x = share * (gross - premium * u)
    k_base = capital(base)
    k_with = capital(base + x)
    delta_k = k_with - k_base
    return {
        'margin': margin,
        'delta_k': delta_k,
        'standalone': margin / capital(x),
        'marginal': margin / delta_k if delta_k > 0 else float('nan'),
        'portfolio_without': base_margin / k_base,
        'portfolio_with': (base_margin + margin) / k_with,
        'over_cost_of_capital': margin - R_C * delta_k,
    }

def share_sweep(base, base_margin, gross, u, premium, shares) -> list:
    """`returns` at each participation, and the return on each step: the
    margin the step adds over the increase in required capital, since the previous
    participation."""
    rows = [returns(base, base_margin, gross, u, s, premium) for s in shares]
    prev = {'margin': 0.0, 'delta_k': 0.0}
    for row in rows:
        step_k = row['delta_k'] - prev['delta_k']
        row['step'] = (row['margin'] - prev['margin']) / step_k if step_k > 0 else float('nan')
        prev = row
    return rows

if __name__ == '__main__':
    gross = contract_gross()
    base = portfolio_outcome(gross)
    heading("Caldera Re's portfolio, six contracts, net of reinstatement premium")
    fields([
        ('Expected outcome (EL)', base.mean()),
        ('TVaR(90%)', outcome_tvar(base)),
        ('Required capital K', capital(base)),
    ], fmt='{:.2f}M')

    c7 = c7_gross()
    u7 = c7_factor()
    m = marginal(base, c7, u7, C7_SHARE, C7_PREMIUM)
    alone = price_with_reinstatement(c7, u7)
    print()
    heading(f"C7 at a {C7_SHARE:.0%} participation, on the ${C7_PREMIUM:.0f}M proposed premium")
    fields([
        ('Expected loss, Caldera Re share', m['el']),
        ('Expected reinstatement premium', m['reinstatement_premium']),
        ('Standalone capital', m['standalone_k']),
        ('Marginal TVaR', m['delta_tvar']),
        ('Marginal capital', m['delta_k'],
         f"{m['delta_k'] / m['standalone_k']:.0%} of standalone"),
    ], fmt='{:.2f}M')
    print()
    heading(f"C7 technical premium against the ${C7_PREMIUM:.2f}M proposed")
    table(['', 'Technical premium, whole layer', 'Price adequacy'], [
        ('Standalone', f"{alone['technical']:.2f}M", f"{C7_PREMIUM / alone['technical']:.1%}"),
        ('Marginal', f"{m['technical']:.2f}M", f"{C7_PREMIUM / m['technical']:.1%}"),
    ])

    margin_b = portfolio_margin(gross)
    r7 = returns(base, margin_b, c7, u7, C7_SHARE, C7_PREMIUM)
    pct = lambda v: 'n/a' if np.isnan(v) else f'{v:.1%}'
    print()
    heading(f"The return at the proposed premium (portfolio RAROC "
            f"{margin_b / capital(base):.1%} without C7)")
    table(['', f'C7, {C7_SHARE:.0%} participation'], [
        ('Margin', f"{r7['margin']:.2f}M"),
        ('RAROC on standalone K', pct(r7['standalone'])),
        ('RAROC on Delta K', pct(r7['marginal'])),
        ('Portfolio RAROC with it', pct(r7['portfolio_with'])),
        ('Margin less the cost of Delta K', f"{r7['over_cost_of_capital']:.2f}M"),
    ])

    shares = [0.05 * i for i in range(1, 11)]
    print()
    heading(f"C7's participation at ${C7_PREMIUM:.0f}M: the return against the portfolio")
    table(['Participation', 'Margin', 'Delta K', 'RAROC on Delta K', 'Step return',
           'Portfolio RAROC', 'Margin less cost of Delta K'],
          [(f'{s:.0%}', f"{r['margin']:.2f}M", f"{r['delta_k']:.2f}M", pct(r['marginal']),
            pct(r['step']), pct(r['portfolio_with']), f"{r['over_cost_of_capital']:.2f}M")
           for s, r in zip(shares, share_sweep(base, margin_b, c7, u7, C7_PREMIUM, shares))])
```

:::caution[Watch Out]
The marginal price is valid for the portfolio it was computed against, and only for it. The order in which contracts join the portfolio changes the result.[^order] If written first, C7 receives the diversification credit of the whole existing portfolio, and a contract written after it is priced against a portfolio that already includes C7. The marginal capitals of two contracts, added, are not the additional capital of both together. Splitting the capital held against a portfolio into contract shares that add up exactly needs an allocation method, such as one based on [Co-TVaR](https://reinsurance.dev/glossary/#co-tvar-contribution-to-tvar).[^euler]
:::

At the proposed price, the question changes from whether to accept to how much the participation earns, [the return on the capital](https://reinsurance.dev/applications/marginal-pricing/#step-5-the-return-on-the-capital).

## Step 5: the return on the capital

A technical premium is the lowest price at which a participation earns the cost of the capital it requires. At the premium the market offers, the underwriter's question is the return: how much the participation earns on the capital it consumes. [Risk-adjusted return on capital (RAROC)](https://reinsurance.dev/glossary/#raroc-risk-adjusted-return-on-capital) divides a margin by a capital. For a participation $s$ at premium $\mathcal{P}$, the margin is the premium plus expected reinstatement premium, less expected loss and expenses:

$$
\text{margin}(X) = s \cdot \mathcal{P} \cdot (1 + \bar u) - (1 + \epsilon) \cdot s \cdot \text{EL}_7
$$

The same margin enters three ratios, which differ in the capital they divide by.

The layer's **standalone RAROC** divides the margin by the capital the participation requires alone:

$$
\text{RAROC}^{\text{standalone}} = \frac{\text{margin}(X)}{K(X)}
$$

The **[marginal RAROC](https://reinsurance.dev/glossary/#marginal-raroc)** divides it by the additional capital the portfolio requires with the participation:

$$
\text{RAROC}^{\text{marginal}} = \frac{\text{margin}(X)}{\Delta K}
$$

The portfolio's RAROC with the participation written adds the margin to the portfolio's own, \$0.80M at its booked premiums, and divides by the capital the portfolio then requires:

$$
\text{RAROC}^{B+X} = \frac{\text{margin}(B) + \text{margin}(X)}{K(B + X)}
$$

Without C7, the portfolio earns [11.0%](https://reinsurance.dev/applications/portfolio-analytics/#step-5-risk-versus-opportunity) on its \$7.25M of required capital.

| C7, 20% participation at \$6M | |
| --- | ---: |
| Margin | \$0.10M |
| Standalone capital $K(X)$ | \$2.67M |
| RAROC on standalone capital | 3.8% |
| Marginal capital $\Delta K$ | \$0.31M |
| RAROC on marginal capital | **32.5%** |
| Portfolio RAROC with the participation (11.0% without) | 11.9% |

On its own, the participation earns 3.8%, below the 10% cost of capital. Against the portfolio, the same \$0.10M margin pays for \$0.31M of additional capital, a 32.5% return, and the portfolio's RAROC increases from 11.0% to 11.9%.

A RAROC is a return before the cost of capital: capital providers expect the margin to cover a 10% return on the capital. What the participation earns above that is $\text{RAROC}^{\text{marginal}} - r_c$, and in dollars the margin after the cost of capital, $\text{margin}(X) - r_c \cdot \Delta K$: \$0.070M for C7's 20% participation.

Wherever $\Delta K > 0$, a marginal RAROC above $r_c$ and a premium above the marginal technical premium are the same test: at C7's marginal technical premium (\$5.68M, rounded) the margin is exactly $r_c \cdot \Delta K$, and the marginal RAROC is 10%. The technical premium is the lowest price to accept; the return measures how much a price above it earns. The [code above](https://reinsurance.dev/applications/marginal-pricing/#step-4-the-marginal-technical-premium) prints both.

:::caution[Watch Out]
A marginal RAROC divides by a small number that can be zero or negative. At a 5% or 10% participation [C7 releases capital](https://reinsurance.dev/applications/marginal-pricing/#how-the-answer-changes-with-the-participation), $\Delta K < 0$, and the ratio is negative although the participation adds margin and reduces the required capital: the ratio has no meaning there. The portfolio's RAROC with and without the participation, and the margin after the cost of capital, $\text{margin}(X) - r_c \cdot \Delta K$, are defined at every participation. On the demo tier, C7's 32.5% also depends on a single trial. The whole \$1.35M change in TVaR inside its denominator, $\Delta K$, comes from Trial 3 replacing Trial 2 in the tail, so a small change in Trial 3's outcome changes $\Delta K$, and with it the return ([At production scale](https://reinsurance.dev/applications/marginal-pricing/#at-production-scale)).
:::

At a fixed \$6M, the return also changes with [the size of Caldera Re's participation](https://reinsurance.dev/applications/marginal-pricing/#the-return-at-each-participation).

## How the answer changes with the participation

The marginal technical premium is not proportional to the participation. The outcomes from a small participation in C7 stay mostly outside the portfolio's tail; the outcomes from a large one form a tail of their own.

*Figure (interactive on the web page): Price adequacy of the \$6M proposed premium against C7's marginal technical premium, at each participation, net of reinstatement premium, on the 20-trial demo tier. Hover a point for its value. The dashed lines mark 100%, where the proposal exactly covers the cost, and the adequacy against C7's standalone technical premium.*

The price adequacy decreases as the participation grows, from 117.9% at 5% to 97.6% at 50%; the marginal technical premium increases from \$5.09M to \$6.15M. At a 5% or 10% participation C7's marginal capital is negative. The required capital is the distance from the portfolio's mean outcome up to its tail average, and a small participation raises the mean more than the tail. At a 5% participation and the \$6M proposal, C7 adds \$0.26M to the mean but only \$0.01M to the TVaR: it pays nothing in Trial 9, and its \$0.89M outcome in Trial 3 raises the portfolio's outcome in that trial to \$17.47M, slightly above Trial 2's \$17.44M. The tail average barely changes while the mean increases, so the distance between them, the required capital, decreases ([the derivation in Step 3](https://reinsurance.dev/applications/marginal-pricing/#step-3-add-the-candidate)). The adequacy crosses 100% between a 35% participation (101.5%) and a 40% one (99.8%): at \$6M the portfolio view accepts a 35% participation and declines a 40% one. It stays above the 88.9% standalone adequacy at every participation, as the sub-additivity bound in [Step 3](https://reinsurance.dev/applications/marginal-pricing/#step-3-add-the-candidate) requires. It approaches that adequacy only as the participation grows, because then C7's own losses make up the tail. The 20% participation the broker offered is well inside the accepted range, and estimates of the curve's shape are reliable only at [production trial counts](https://reinsurance.dev/applications/marginal-pricing/#at-production-scale).

### The return at each participation

The broker offers 20%, but the participation is negotiable: Caldera Re can ask for a larger one or accept a smaller one. The standalone view does not distinguish between them. At \$6M, C7's margin and its standalone capital both scale with the participation, so its standalone RAROC is 3.8% at every size. Against the portfolio, the return changes with the participation.

In the table, the participation increases in steps of 5 points. Each step adds margin and increases the required capital; the margin a step adds, divided by the increase in required capital, is the **return on that step**. A step that earns more than the 10% cost of capital adds value to Caldera Re; a step that earns less removes it. Going from 15% to 20%, for example, adds \$0.025M of margin and \$0.186M of required capital, a 13.6% return on the step.

| C7 participation at \$6M | Margin | $\Delta K$ | RAROC on $\Delta K$ | Return on the step | Portfolio RAROC | Margin after the cost of capital |
| ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| 5% | \$0.03M | −\$0.25M | n/a | n/a | 11.8% | \$0.050M |
| 10% | \$0.05M | −\$0.06M | n/a | 13.6% | 11.8% | \$0.057M |
| 15% | \$0.08M | \$0.12M | 60.6% | 13.6% | 11.9% | \$0.063M |
| 20% | \$0.10M | \$0.31M | 32.5% | 13.6% | 11.9% | \$0.070M |
| 25% | \$0.13M | \$0.50M | 25.4% | 13.6% | 12.0% | \$0.076M |
| 30% | \$0.15M | \$0.78M | 19.4% | 8.9% | 11.9% | \$0.073M |
| 35% | \$0.18M | \$1.42M | 12.4% | 3.9% | 11.3% | \$0.034M |
| 40% | \$0.20M | \$2.06M | 9.8% | 3.9% | 10.8% | −\$0.005M |
| 45% | \$0.23M | \$2.71M | 8.4% | 3.9% | 10.3% | −\$0.044M |
| 50% | \$0.25M | \$3.35M | 7.5% | 3.9% | 9.9% | −\$0.083M |

The step return has two values, and the character of the tail determines which applies.

- **From 5% to 28.9%, each step earns 13.6%.** The tail is Trial 9, in which C1 exhausts its aggregate limit, and Trial 3. Only Trial 3 contains a C7 loss, so a step raises the tail's average by half of what it adds to that trial. That is more than the 10% cost of capital and more than the portfolio already earns, so the portfolio's RAROC increases with every step, to 12.0%.
- **Above 28.9%, each step earns 3.9%.** Trial 5 replaces Trial 9, and both tail trials now contain a full-limit C7 loss. Further points of participation in C7 are no longer diversified: both of the portfolio's tail trials are trials in which C7 pays its full limit, so a step raises both tail trials, and each further point of participation adds C7's risk almost as it would alone. The step return decreases to close to the 3.8% C7 earns alone. Each step now earns less than the cost of capital, and the portfolio's RAROC decreases, to 9.9% at 50%.

The 25% to 30% step spans the change, so its 8.9% averages the two returns. Until Trial 3 enters the tail, just below 5%, C7's outcome raises only the portfolio's mean, which releases capital, and the portfolio's RAROC increases steeply, from 11.0% to 11.8%.

*Figure (interactive on the web page): Caldera Re's portfolio RAROC with C7 written at each participation, at the \$6M proposed premium, net of reinstatement premium, on the 20-trial demo tier. Hover a point for its value. The dashed lines are the portfolio's RAROC without C7 and the cost of capital; the dotted line marks the participation above which both tail trials contain a full-limit C7 loss.*

The margin after the cost of capital, $\text{margin}(X) - r_c \cdot \Delta K$, is the value a participation adds: the amount left after deducting 10% of the capital it consumes. It is the participation's profit in an economic sense. The margin is an expected accounting profit, before tax and investment income: what the income statement shows on average; the cost of capital is not booked as an expense, and deducting the capital providers' required 10% return on capital leaves the margin after the cost of capital.

*Figure (interactive on the web page): C7's margin less 10% of the additional capital it requires, at each participation, at the \$6M proposed premium, net of reinstatement premium, on the 20-trial demo tier. Hover a point for its value. The dotted lines mark the maximum and the participation at which the margin exactly covers the cost of the capital.*

:::tip[Key Insight]
**The participation that adds the most value is smaller than the largest one whose costs the price covers.** The value added increases while each step earns 13.6%, more than the 10% cost of capital, and decreases once each step earns 3.9%. It peaks at a 28.9% participation, at \$0.082M, compared with \$0.070M at the offered 20%.

Price adequacy measures whether the participation as a whole earns its cost of capital. The participation earns it up to 39.4%, where the value added falls to zero and the RAROC on $\Delta K$ is exactly 10%. Between 28.9% and 39.4% the whole participation still earns more than 10%, but only because the surplus of the first 28.9% pays for the points above it, each of which earns 3.9%. Those points reduce the value added, so on this data the value-maximising participation is 28.9%, where the next step stops earning the cost of capital, rather than 39.4%.

The portfolio's RAROC also peaks at 28.9%. Above it each step earns 3.9%, less than the 12.0% the portfolio earns at that point, so every further step lowers the portfolio's average return.
:::

:::caution[Watch Out]
The sharp change at 28.9% is a feature of a 20-trial tail. Its position depends on the gap between the outcomes of two trials, Trial 9 and Trial 5, and a small change in either moves it. In a well diversified portfolio at production trial counts, trials with large C7 losses enter a tail of thousands of trials one by one as the participation grows, so the step return decreases gradually and there is no single participation at which it drops. That is why the underwriter takes the 20% offered rather than countering at 29%: the demo-tier calculation demonstrates the method, but its 28.9% result is too sensitive to the two trial outcomes to quote.
:::

Every marginal figure on this page is fragile in the same way at 20 trials; [At production scale](https://reinsurance.dev/applications/marginal-pricing/#at-production-scale) shows how larger trial counts reduce that.

## At production scale

Every marginal figure on this page is the difference of two TVaR estimates, and at 20 trials each estimate averages two trials. C7's \$1.35M change in TVaR comes from one trial, Trial 3, moving from slightly outside the tail to the top of it. An average of two trials is volatile: a small change in one trial's outcome can change which trials make up the tail, and with them the character of the tail and its average. The 32.5% return, the \$5.68M floor and the 28.9% peak all depend on which trials make up the tail. The method is exact at any trial count; only the estimates are fragile. A production model runs [10,000 to 1,000,000+ trials](https://reinsurance.dev/toolkit/trials/#demo-scale). The demo data's 1,000-trial tier shows the effect of that resolution: each 90% tail contains 100 trials, so no single trial crossing the tail boundary can determine the estimate. The C7 decision, and the \$5.68M marginal floor above all, are a demonstration of the method: a production team would compute the same figures from a production-scale run before quoting on them.

:::caution[Watch Out]
A marginal figure is far noisier than the standalone figures it is computed from. Both TVaR estimates carry sampling error, and their difference is small next to either error. Computing both on the same trials cancels most of it. A production run needs enough trials to populate both tails, with and without the candidate, and the same trial ids for both, so that the difference is taken trial by trial rather than between two independent simulations.
:::

The computation is cheap once the portfolio's outcome is kept. The portfolio's per-trial array, $B_j$, is the only state. Computing it is the whole roll-up over $R$, the number of [year event loss table (YELT)](https://reinsurance.dev/glossary/#yelt-year-event-loss-table) rows across every contract: $O(R \log R)$ with the claims-order sort below, or $O(R)$ when the YELTs are stored in claims order. It is recomputed only when a contract is bound. A quote for a candidate then costs:

- **The candidate's composition.** Occurrence and aggregate terms process a cedent's losses in claims order, sorted by trial and date. The candidate's $R_c$ YELT rows are sorted once, $O(R_c \log R_c)$, and the terms then pass over them in $O(R_c)$.
- **The sum.** $B_j + X_j$ is one addition per trial, $O(N)$.
- **The TVaR of the sum.** TVaR needs only the $k = (1 - \alpha) \cdot N$ largest outcomes. The code above builds the full [exceedance probability (EP) curve](https://reinsurance.dev/glossary/#ep-curve-exceedance-probability-curve), which sorts all $N$ outcomes, $O(N \log N)$. A selection algorithm such as `np.partition` finds the $k$ largest in $O(N)$ on average without ordering the rest.

The fixed-point loop repeats the sum and the TVaR once per iteration until convergence. At a million trials each iteration is a few array passes, so a quote takes seconds. This is the chapter's [one computational shape](https://reinsurance.dev/applications/production-scale/#one-computational-shape): the portfolio's outcome kept current as one array per trial, and every quote computed by adding a candidate array to it. Two underwriters quoting against the same portfolio at the same time each price against a portfolio without the other's contract. Whichever contract binds second was priced against a portfolio that no longer exists, and needs to be priced again before it binds.

## What carries forward

Marginal pricing is standalone pricing with a non-empty portfolio. The capital formula, the pricing equation, and the reinstatement premium inside it are the same; the new input is the portfolio outcome $B_j$, and the new output is the difference $\Delta K$. For Trident Re's layer the two views disagree: standalone pricing declines the \$6M proposal, and against the portfolio the underwriter accepts a 20% participation, with a marginal floor of \$5.68M on the demo tier. At the proposed price the participation earns 32.5% on the capital it consumes and raises the portfolio's RAROC from 11.0% to 11.9%. The size of the participation changes that return as well; on the demo tier a larger one would add more value up to about 29%, but that figure depends on two trials, and the underwriter accepts the 20% offered.

Across the [Applications chapter](https://reinsurance.dev/applications/), the arithmetic of every story is the same, and what changes is the portfolio a contract is measured against. The portfolio C7 was priced against is the one whose outcomes the [portfolio analytics](https://reinsurance.dev/applications/portfolio-analytics/) story rolls up.

[^marginal-total]: Gary G. Venter, John A. Major, and Rodney E. Kreps, ["Marginal Decomposition of Risk Measures"](https://doi.org/10.2143/AST.36.2.2017927), *ASTIN Bulletin* 36(2), 2006: "Marginal impact can be incremental or total, that is the impact could be that of a small change or of the entire business component." The total sense, the change in the risk measure when the whole contract is added, is the one Kreps's marginal-surplus method uses (Kreps 1990, cited above) and the one this page uses. John A. Major and Stephen J. Mildenhall, [*Introduction to Capital Modeling and Portfolio Management*](https://www.casact.org/sites/default/files/2026-01/CAS_Monograph_15_-_Intro_to_Capital_Modeling.pdf), CAS Monograph 15, Casualty Actuarial Society, 2026, §3.3, takes the incremental sense as its default, so both meanings of *marginal* are in use.

[^subadditive]: Philippe Artzner, Freddy Delbaen, Jean-Marc Eber, and David Heath, ["Coherent Measures of Risk"](https://onlinelibrary.wiley.com/doi/full/10.1111/1467-9965.00068), *Mathematical Finance* 9(3), 1999, define sub-additivity as a coherence axiom and show that VaR does not satisfy it. Carlo Acerbi and Dirk Tasche, ["On the Coherence of Expected Shortfall"](https://arxiv.org/abs/cond-mat/0104295), *Journal of Banking & Finance* 26(7), 2002, prove that the averaging form of the tail mean, the one this site computes, is coherent and therefore sub-additive.

[^order]: Donald F. Mango, ["Capital Consumption: An Alternative Methodology for Pricing Reinsurance"](https://www.casact.org/sites/default/files/database/forum_03wforum_03wf351.pdf), *CAS Forum*, Winter 2003, lists both problems of allocating capital on a marginal basis, that marginal amounts do not add up to the total and that they depend on the order of entry: "Do you re-balance so it adds up to the total? What about order dependency?"

[^euler]: Dirk Tasche, ["Capital Allocation to Business Units and Sub-Portfolios: the Euler Principle"](https://arxiv.org/abs/0708.2542), arXiv:0708.2542, 2008, gives the allocation whose contributions add up to the total for risk measures such as TVaR.

[^marginal-practice]: Rodney Kreps, ["Reinsurer Risk Loads from Marginal Surplus Requirements"](https://www.casact.org/sites/default/files/database/proceed_proceed90_90196.pdf), *Proceedings of the Casualty Actuarial Society* 77, 1990. Prices a contract from the additional surplus it requires on top of the reinsurer's existing book, so the risk load depends on the contract's covariance with that book. Donald F. Mango, ["Capital Consumption: An Alternative Methodology for Pricing Reinsurance"](https://www.casact.org/sites/default/files/database/forum_03wforum_03wf351.pdf), *CAS Forum*, Winter 2003, calls this marginal method "a de facto reinsurance industry standard pricing method". Rodney Kreps, ["Investment-Equivalent Reinsurance Pricing"](https://www.casact.org/sites/default/files/2021-02/pubs_proceed_proceed98_980101.pdf), *Proceedings of the Casualty Actuarial Society*, 1998, treats the stand-alone risk load as "a reasonable maximum" because contracts mutually support each other. Its footnote 10, choosing between two stand-alone loads, notes that the smaller offers the reinsurer "competitive advantage" though it "may prefer to charge more if the market will bear it"; applying that to the marginal-versus-standalone gap is this site's inference.
