Pro Feature. Requires a Pro or Ultra subscription. Get started at api.mathematicalcompany.com
Robustness Testing
Three statistical tests designed specifically for prediction markets. They answer a question every trader must ask: “Is my edge real, or did I just get lucky?”Event Permutation
Shuffle which outcomes map to which markets. Tests whether your market selection was skillful.
Outcome Randomization
Keep trades fixed, re-draw binary outcomes from Bernoulli(p). Tests whether you got lucky on resolutions.
Path Simulation
Shuffle trade ordering to test if your drawdown and loss streaks were unusually good or bad.
Quick Start
Event Permutation Test
Tests whether your strategy’s market selection was genuinely skillful. Since prediction market events are independent, the order in which outcomes resolve shouldn’t matter if your edge is real. This test shuffles which outcomes map to which markets and recomputes PnL. If your observed PnL is in the upper tail of the permuted distribution, your selection was skillful (not lucky).Signature
Example
PermutationTestResult
Mathematical Details
Mathematical Details
Let be the set of all permutations of outcome assignments. For each permutation :The p-value is computed conservatively:Under (no selection skill), the observed PnL should be typical of the permuted distribution. A small p-value rejects .
Outcome Randomization
Tests whether your realized outcomes were luckier than expected given market pricing. Keeps every trade exactly as-is (same prices, sizes, timing). For each simulation, re-draws each market’s binary outcome fromBernoulli(p) where p is the market’s implied probability (average buy price). If your strategy has genuinely better calibration than the market, your real PnL will sit in the upper tail.
Signature
Example
OutcomeRandomizationResult
How it works
How it works
For closed round-trips (buy then sell before expiry), the PnL is fixed regardless of the final outcome. Only open positions held to resolution contribute to variance across simulations.For each simulation :
- For each market , draw where is the implied probability
- Compute resolution PnL from open positions using
- Total PnL = (fixed round-trip PnL) + (random resolution PnL)
PnL Path Simulation
Tests whether your drawdown and loss streaks were unusually good or bad. Total PnL is invariant to ordering (same sum), but path-dependent statistics like max drawdown and consecutive losses depend heavily on which order trades occurred. This test shuffles the order of round-trip PnLs and computes a distribution of these path statistics.Signature
Example
PathSimulationResult
Why drawdown depends on ordering
Why drawdown depends on ordering
Consider two sequences of trade PnLs:
[+10, +10, -5, -5] and [-5, -5, +10, +10].Both have the same total PnL (+10), but:- Sequence 1: max drawdown = 10 (peak at +20, trough at +10)
- Sequence 2: max drawdown = 10 (peak at 0, trough at -10)
Convenience Wrapper
Run all three tests with a single call:- permutation and outcome require
outcomeswith >= 2 markets - path requires at least 1 trade
RobustnessReport
Interpreting Results
p-values
Which test tells you what
Recommended workflow
- Run all three tests with >= 1000 simulations
- If permutation test fails: your market selection may be random
- If outcome test fails: your calibration edge may not be real
- If path test shows unfavorable drawdown: size down — your worst drawdown is likely ahead