Commit 255698d
B1+B2: antithetic-variates Monte Carlo with best-of-both estimator selection,
CVaR-based risk loading (coherent measure)
B1 — VARIANCE REDUCTION (antithetic variates with adaptive estimator)
src/pricing/price-model.js
- Refactored: drawDaily(days, rng) generates a stream of per-day tuples
{ z, u, jz } (diffusion innovation, jump-Bernoulli uniform, jump-mag innov).
- integratePath({ R0, draws, params, flipDiffusionSign? }) runs the SDE on
a precomputed draw sequence. Pure function — no RNG side effects — so it
composes with variance-reduction wrappers.
- simulateAntitheticPair({ R0, days, params, rng }) returns { a, b } two
paths that share every uniform/jump-magnitude draw but have sign-flipped
diffusion innovations. The standard antithetic construction for
jump-diffusion (flip Z's only — flipping jump draws would just be a
different sample, not a paired one).
- simulatePath() unchanged signature; now uses drawDaily + integratePath
internally so the same code path is exercised.
src/pricing/pricer.js
- Runs in antithetic pairs (ceil(paths/2) pairs × 2 = effectivePaths).
- BOTH estimators computed every quote:
plainSE — std error across all 2N paths
antitheticSE — std error across N pair-means
- Antithetic helps diffusion-dominated payoffs (ATM caps with low jump
intensity) — variance reduction factor in the 2-3× range. It can HURT
jump-dominated payoffs (deep OTM where the variance is dominated by
shared jumps across the pair, inflating pair-mean variance).
- Headline CI / risk load uses min(plainSE, antitheticSE). The
varianceReductionFactor = (plainSE / bestSE)² is therefore ≥ 1 always.
- usedEstimator: 'antithetic' | 'plain' tells the UI which one won.
B2 — CVaR-BASED RISK LOADING (coherent risk measure)
src/pricing/pricer.js
- Tracks every per-path payout (sorted at the end) so CVaR_β can be
computed exactly from the empirical distribution.
- riskLoadMode: 'cvar' (default) | 'stdev'
cvar: risk_load = max(0, cvarAlpha · (CVaR_β − E[payout]))
— α defaults to 0.15; β defaults to 0.95 (5% tail).
CVaR is the mean of payouts in the worst (1−β) tail; it
satisfies the four coherent-risk axioms (subadditivity,
monotonicity, positive homogeneity, translation invariance).
Stdev does NOT satisfy subadditivity, which is why the actuarial
and Solvency II literature has moved to ES/CVaR.
stdev: risk_load = riskLoadStdevMultiplier · bestSE (legacy mode,
still selectable per quote for backward compat).
- The output now includes cvarHbar, cvarBeta, riskLoadMode.
test/variance-reduction.test.js (9 new tests):
- Antithetic pairs share jump locations + have opposite diffusion increments
- With jumps off, pair has perfectly negative diffusion correlation
(deterministic sum of log-prices across two different seeds)
- varianceReductionFactor ≥ 1 always (best-of-both estimator)
- Substantial reduction on ATM payoffs (>1.5× with λ=0)
- CVaR ≥ expected payout (definition)
- CVaR risk load positive on OTM caps with tail mass
- stdev vs cvar mode produce different decompositions
- Deep-OTM boundary: cvar → 0 when no path enters the money
- effectivePaths = round-up-to-even on odd input
82/82 tests pass (was 73). All pure / no testnet required.
Sources for the upgrade:
- Dean Francis Press 2025: "Variance Reduction in Monte Carlo Option Pricing:
A Comparative Analysis of Control Variates, Multiple Control Variates and
Antithetic Variates" — confirms antithetic dominance on diffusion-driven
payoffs, multi-control superiority elsewhere.
- Hardy (CAS) "An Introduction to Risk Measures for Actuarial Applications":
CVaR's four coherence axioms, why ES has displaced VaR/stdev in actuarial
practice.
- Wang (1995) "Insurance Pricing and Increased Limits Ratemaking" — the
next layer (Wang-transform pricing) is future work documented in
LIMITATIONS.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b519908 commit 255698d
3 files changed
Lines changed: 368 additions & 92 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
62 | 99 | | |
63 | 100 | | |
64 | 101 | | |
65 | | - | |
| 102 | + | |
66 | 103 | | |
67 | | - | |
| 104 | + | |
68 | 105 | | |
69 | 106 | | |
70 | | - | |
| 107 | + | |
71 | 108 | | |
72 | | - | |
73 | | - | |
| 109 | + | |
74 | 110 | | |
75 | 111 | | |
76 | 112 | | |
77 | 113 | | |
78 | 114 | | |
79 | | - | |
| 115 | + | |
80 | 116 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
88 | 124 | | |
89 | 125 | | |
90 | 126 | | |
91 | 127 | | |
92 | 128 | | |
93 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
94 | 172 | | |
95 | 173 | | |
96 | 174 | | |
| |||
0 commit comments