Validation

Closed form vs Monte Carlo

Each Model identity is z-tested against a Monte Carlo run. You can regenerate the run with npm run simulate -- --seed 42 && npm run sweep -- --seed 42.

The z-score \(z = (\mathbb{E}_{\mathrm{mc}}[\Pi] - \mathbb{E}_{\mathrm{cf}}[\Pi]) / \mathrm{stderr}\) standardises the MC mean against its closed-form target. We treat \(|z| \le 2\) as sampling noise and \(|z| > 3\) as suspect. Three identities are exact rather than statistical. The ratio \(\mathrm{Var}[\Pi_{\mathrm{b2b}}] / \mathrm{Var}[R_{\mathrm{fee}}] = 1 / f^2\) is algebraic. The matched-desk identity \(\Pi_{\mathrm{b2b}} + \mathrm{treasury}(N P, N P S_0) = N(Q - P S_0)\) holds path by path. The retained SD identity \(\mathrm{SD}[\Pi_{\mathrm{ret}}] = (1 - \beta) \mathrm{SD}[\Pi_{\mathrm{b2b}}]\) is an algebraic consequence of \(\Pi_{\mathrm{ret}} = (1 - \beta) \Pi_{\mathrm{b2b}} + \pi_{\mathrm{syn}}\). The full symbol and risk-metric definitions sit in Setup and notation. The sections below draw from data/run-42.json.

Run parameters

The cards below show the parameters of the fixed Monte Carlo run that the rest of this page validates against. The price process is specified by \((\mu, \sigma, T)\), the throughput by \(\lambda\), and the business levers by \((f, Q, \alpha)\). The last card reports the break-even quote \(Q^*\).

Per-book scorecard

The table below has one row per stochastic book and one column per statistic; closed-form and Monte Carlo results sit side by side. The switching row has no closed-form mean or SD, because its P&L density has no closed form. The four mean-level anchors for the switching book — the first-passage probability \(\mathbb{P}[\tau \le T]\), the expected first-passage time \(\mathbb{E}[\tau \wedge T]\), the expected time in fee mode \(\mathbb{E}[T_{\mathrm{fee}}]\), and the expected fee-mode spot integral \(\mathbb{E}[I_{\mathrm{fee}}]\) — are tested further down.

\(\Pi\) is the row book’s terminal P&L in USD over \([0, T]\).

column meaning
\(\mathbb{E}[\Pi]\) (cf) / (mc) closed-form / MC mean
\(\pm \mathrm{CI}_{95}\) \(1.96 \cdot \mathrm{SD} / \sqrt{n}\)
SD (cf) / (mc) closed-form / MC SD
\(z\) \((\mathbb{E}_{\mathrm{mc}} - \mathbb{E}_{\mathrm{cf}}) / \mathrm{stderr}\)
\(\mathrm{VaR}_{95} / \mathrm{VaR}_{99}\) 5% / 1% loss thresholds
\(\mathrm{CVaR}_{95} / \mathrm{CVaR}_{99}\) tail means
\(\mathbb{P}[\Pi < 0]\) loss probability
Sharpe \(\mathbb{E}[\Pi] / \mathrm{SD}[\Pi]\) (horizon-absolute)

A z-score in the \(\pm 2\) range is sampling noise. A b2b row whose MC variance equals \(1 / f^2\) times the fee MC variance confirms the algebraic identity between the two books.

Desk compositions

The table below shows how the operating books and the treasury combine into full desks. The matched desk \(= N(Q - P S_0)\) is deterministic, so its closed-form and MC values coincide. The partial_desk at run.params.alpha uses the \(J_\alpha\) closed form. The syndicated_matched desk \(= \mathrm{retained} + \mathrm{treasury}(N P, N P S_0)\) is still deterministic up to the premium. The switching_matched desk \(= \mathrm{switching} + \mathrm{treasury}(N P, N P S_0)\) is reported from Monte Carlo only. The switching_partial_desk \(= \mathrm{switching} + \mathrm{treasury}(\alpha N P, \alpha N P S_0)\) pairs the switching operating book with the \(\alpha\)-partial treasury at run.params.alpha; MC only.

The matched row confirms the deterministic identity \(N(Q - P S_0)\) to machine precision. The partial_desk row tracks the \(J_\alpha\) closed form to within sampling noise.

Distribution checks

The three sub-sections below move from moment-level checks on the Merton compensation to full empirical distributions of per-book P&L and of the driving integral \(I_T\).

Mean invariance under Merton

With the Merton compensation in place, means match pure GBM exactly and variances grow. The canonical overlay used here is \(\lambda_J = 3\)/yr, \(\mu_J = -0.1\), \(\sigma_J = 0.15\). We expect \(|z| \lesssim 2\) on the means and \(\mathrm{SD}_{\mathrm{merton}} > \mathrm{SD}_{\mathrm{gbm}}\) on the variances.

The table below compares the closed-form GBM prediction to a Monte Carlo run that includes the jump overlay, one row per book. The columns report both means, both SDs, the MC 95 % confidence interval, and the z-score of the jump-aware MC mean against the pure-GBM closed form.

Overlay from JUMP_CHECK in the CLI.

Means agree within sampling noise, and Merton SDs exceed GBM SDs on every book; this is the jump variance overlay at work.

The card below spot-checks the terminal-price identity \(\mathbb{E}[S_T] = S_0 e^{\mu T}\), which should hold for every \((\lambda_J, \mu_J, \sigma_J)\) under the Merton compensation.

P&L distributions

The panels below show one empirical histogram per stochastic book; the x-axis is terminal P&L in USD, and the y-axis is empirical density. The black rule is the closed-form mean. The dashed grey rule sits at \(\Pi = 0\), so the mass to its left is \(\mathbb{P}[\Pi < 0]\).

Black: closed-form \(\mathbb{E}[\Pi]\). Dashed grey: \(\Pi = 0\).

The black rule lands inside every histogram hump, confirming that the closed-form means match the empirical distributions.

The \(I_T\) histogram

The histogram below shows the Monte Carlo distribution of the spot integral \(I_T = \int_0^T S_t \, dt\). The solid black rule marks the Dufresne mean \(\mathbb{E}[I_T]\), and the dashed black rules mark \(\pm 1\) SD around it. \(I_T\) is not log-normal, so tail quantiles still require Monte Carlo.

Black: \(\mathbb{E}[I_T]\). Dashed: \(\pm \mathrm{SD}[I_T]\).

The empirical histogram is visibly asymmetric and sits to the right of the mean, which is the lognormal skew of \(I_T\) coming through.

Matched treasury

The matched treasury has deterministic terminal P&L by construction, but its interim NAV path and intra-horizon drawdown are the funding-risk profile the shape hides.

Shortfall

We define the worst interim NAV drawdown as

\[ D := \max_{t \le T} \bigl[ N P (1 - t/T) (S_0 - S_t) \bigr]_+. \]

The histogram below counts Monte Carlo paths by their value of \(D\); the two black rules mark the 95th and 99th percentiles (dashed and solid respectively).

Dashed: 95th. Solid: 99th.

The right tail is the intra-horizon funding need the matched treasury exposes, even though its terminal P&L is zero by construction.

Parameter sweep

We fix the partial-desk composition and sweep the drift, volatility, and coverage fraction \((\alpha, \mu, \sigma)\) over a grid. The data comes from data/sweep.json. The two sliders below select a slice of the grid.

Tail risk vs volatility \(\sigma\)

The chart below plots the 95 % tail-mean loss \(\mathrm{CVaR}_{95}\) of the partial desk, in USD, against the annualised volatility \(\sigma\) at the selected \((\alpha, \mu)\).

Partial-desk CVaR₉₅ vs \(\sigma\).

CVaR₉₅ grows monotonically with \(\sigma\), as expected since higher volatility fattens the loss tail of the uncovered window.

Tail risk vs coverage \(\alpha\)

The chart below plots the same tail-mean loss against the coverage \(\alpha\), with volatility fixed at the second grid value. CVaR decays with \(\alpha\), and at \(\alpha = 1\) the desk is deterministic, so CVaR₉₅ collapses to the sign of the matched P&L.

Syndication

The formulae for syndication live in Syndicating the back-to-back book. At \(\theta = 0\), \(\Pi_{\mathrm{ret}}\) is an affine rescaling of \(\Pi_{\mathrm{b2b}}\) with slope \((1 - \beta)\), so the pricing is closed form and no extra Monte Carlo is needed. The cvar-mode factor \(\phi(\Phi^{-1}(0.95))/0.05 \approx 2.063\) puts the sharpe and cvar loads on a common SD scale. The three sliders below control the slice we visualise.

Retained CVaR₉₅ across \(\beta\)

The chart below plots the retained book’s 95 % tail-mean loss against the cession fraction \(\beta\). The curve collapses linearly in \((1 - \beta)\), and a positive counterparty load \(\theta\) lifts it by \(\beta \rho(\theta)\).

The straight line is the \((1 - \beta)\) rescaling of the b2b tail translated into CVaR space; at full cession \(\beta = 1\) the tail sits at the negative of the mean b2b P&L, ceded away.

Fair vs loaded premium

The chart below plots the premium the intermediary receives as a function of the cession fraction \(\beta\), with one curve per counterparty load \(\theta\). At \(\theta = 0\) the premium is actuarially fair, \(\pi_{\mathrm{fair}} = \beta \mathbb{E}[\Pi_{\mathrm{b2b}}]\). At \(\theta > 0\) the load pulls the premium down by \(\beta \rho(\theta)\).

Expected-P&L cost of syndication

The chart below plots the expected-P&L shift \(\mathbb{E}[\Pi_{\mathrm{ret}}] - \mathbb{E}[\Pi_{\mathrm{b2b}}]\) against the cession fraction \(\beta\), again with one curve per counterparty load \(\theta\). At \(\theta = 0\) the curve is flat, so cession is a free lunch in expectation. At \(\theta > 0\) the load drags the expected P&L down linearly in \(\beta\): the intermediary pays the counterparty the load in exchange for tail relief.

Switching

The formulae live in Switching to fee above a threshold. The switching P&L density has no closed form, so Monte Carlo is authoritative on the tails. Four pure-GBM mean anchors are still z-testable: the first-passage probability \(\mathbb{P}[\tau \le T]\), the expected first-passage time \(\mathbb{E}[\tau \wedge T]\), the expected time in fee mode \(\mathbb{E}[T_{\mathrm{fee}}]\), and the expected fee-mode spot integral \(\mathbb{E}[I_{\mathrm{fee}}]\). Jumps change the \(\tau\) distribution, so under jumps those anchors fall back to Monte Carlo too.

Mean and tail vs threshold

The first chart below shows how the 95 % tail-mean loss changes as the threshold \(h\) falls from the no-switch limit, and the second shows the same for the expected P&L. Solid coloured line: the switching book. Dashed grey rule: the retained anchor at \(h = \infty\). As \(h\) falls, the tail loss drops from the b2b reference toward fee-book levels and the mean rises. Paths that re-enter below the threshold limit how far the cut goes.

Tightening \(h\) trades expected P&L for a tighter tail, but re-entries limit how far the tail can be cut.

Pure-GBM anchors

The table below tests the four pure-GBM mean anchors, one row per threshold \(h\). Closed-form values come from src/core/moments.ts, MC values come from the switching sweep, and z-scores compare the two. A small discrete-crossing bias in \(\mathbb{P}[\tau \le T]\) and \(\mathbb{E}[\tau \wedge T]\) shrinks as \(n_{\mathrm{steps}}\) grows.

Time and count in fee mode

The table below reports how often and how long the switching book sits in fee mode, one row per threshold \(h\). The expected fee-mode time fraction \(\mathbb{E}[T_{\mathrm{fee}}/T]\) decreases with \(h\). The expected crossing count E[# crossings] counts \(\mathrm{sign}(S - H)\) flips on the discretised path.

Break-even quote surface

The break-even quote \(Q^*\) equalises the expected P&L of the fee and b2b books. In dimensionless form it reads

\[ \frac{Q^*}{(1 + f) P S_0} = \frac{e^{\mu T} - 1}{\mu T}. \]

The chart below plots this ratio against the horizon \(T\), with one coloured curve per drift \(\mu\). The dashed grey rule at \(1.0\) is the \(\mu \to 0\) limit.

One curve per \(\mu\).

A positive drift lifts the curve above the \(\mu = 0\) line, and a negative drift sits below it.