Quant Memo
Advanced

Always-Valid Inference and e-Values

A way of testing a hypothesis that stays statistically honest even if you peek at the results after every new data point and stop the moment you like what you see — something an ordinary p-value cannot survive.

Prerequisites: Hypothesis Testing, Sequential Hypothesis Testing

A trader running a live A/B test between two execution algorithms wants to know as soon as possible which one is better, and checks the results every morning. An ordinary p-value is only trustworthy if you fix the sample size in advance and look exactly once. Check it every day and stop the first morning it dips below 0.05, and the true chance of a false alarm is no longer 5% — it can climb past 30% or 50%, because you gave yourself many chances to get lucky. Always-valid inference, built on a tool called the e-value, is designed to survive exactly this kind of repeated peeking: you can look after every single trade and stop whenever you want, and the guarantee against false alarms still holds.

An analogy: betting against the null hypothesis

Imagine you're allowed to bet, at odds you set yourself, against the idea that "nothing is different" (the null hypothesis). Before seeing any data, you commit to fair-odds wagers: if the next observation looks like what the null predicts, you lose a bit of your stake; if it looks like the alternative, you win a bit. Your running wealth, after any number of bets, is the e-value. Because the bets were fair under the null, your wealth has no tendency to drift up if the null is actually true — on average it just holds steady. A basic fact about such fair betting games (Ville's inequality) says the chance your wealth ever multiplies itself by 20 or more, at any point during an unboundedly long sequence of fair bets, is at most 1/20. That single fact is what lets you monitor continuously: no matter when you stop and look, the odds of having been fooled are capped.

The mechanics, one symbol at a time

Let ee denote the e-value after some number of observations — think of it as your current wealth in the betting game, starting at e=1e = 1. A valid e-value must satisfy E0[e]1\mathbb{E}_0[e] \le 1, where E0\mathbb{E}_0 is the expectation if the null hypothesis is really true — in words, if nothing is going on, your wealth shouldn't grow on average. You build ee by multiplying together a small "bet factor" for each new observation: a factor bigger than 1 if the observation favors the alternative, smaller than 1 if it favors the null. You reject the null the moment ee crosses a threshold 1/α1/\alpha (for a 5% test, that's 1/0.05=201/0.05 = 20), and this stopping rule is valid regardless of when you decide to stop — you can check after every trade, every hour, or only on Fridays, and the false-alarm rate stays capped at α\alpha.

Worked example 1: building the wealth process by hand

Suppose the null hypothesis is that an algorithm fills 50% of its passive orders (a coin-flip). Design a fair bet: multiply the running e-value by 1.4 on a fill and by 0.6 on a miss. This is mean-preserving under the null because 0.5×1.4+0.5×0.6=10.5 \times 1.4 + 0.5 \times 0.6 = 1, so E0[e]=1\mathbb{E}_0[e] = 1 exactly, as required. After 10 trades with 7 fills and 3 misses:

e=1.47×0.6310.54×0.2162.28.e = 1.4^{7} \times 0.6^{3} \approx 10.54 \times 0.216 \approx 2.28 .

That's evidence in favor of the alternative (fills are happening more than 50% of the time), but it's nowhere near the reject threshold of 20, so you keep collecting data — and because this is an e-value, you're allowed to.

Worked example 2: crossing the threshold mid-stream

The algorithm keeps running at the same true 70% fill rate. After 40 trades total (28 fills, 12 misses):

e=1.428×0.61212,342×0.0021826.9.e = 1.4^{28} \times 0.6^{12} \approx 12{,}342 \times 0.00218 \approx 26.9 .

That's above 1/α=201/\alpha = 20, so you reject the null right there, at trade 40 — even though you also checked and failed to reject at trade 10, and at every trade in between. Ordinary p-values don't allow this: recomputing a fresh p-value at every trade and stopping the first time it looks significant would have inflated the real false-positive rate well above 5%. The e-value's multiply-as-you-go construction is exactly what keeps the guarantee intact under continuous peeking.

trade number threshold 1/α = 20 n=10, e=2.3 n=40, e=26.9
The e-value climbs as evidence accumulates. It stays valid to check at every point along this path — the reject decision at trade 40 is not undermined by having peeked earlier.
number of peeks before stopping 1 peek: 5% 5 peeks: ~14% 20 peeks: ~25% 100 peeks: ~40%+
Ordinary p-values were never designed for repeated checking: the more often you look and stop at the first "significant" result, the further the real false-positive rate drifts above the advertised 5%.

What this means in practice

Always-valid inference is what makes it safe to run live dashboards on trading experiments — A/B tests of execution algorithms, signal changes, or risk overlays — and to stop a test as soon as the evidence is clear, rather than pre-committing to a fixed sample size and staring at a locked dashboard until it's reached. It's the modern engine behind sequential monitoring tools, and it composes cleanly: e-values from independent tests can simply be multiplied together, which makes combining evidence across desks or time periods far easier than combining ordinary p-values correctly.

An e-value is a betting-game wealth process that starts at 1 and, on average, cannot grow if the null hypothesis is true. Because of that property, you may check it after every new observation and reject the null the instant it crosses 1/α1/\alpha, with the false-alarm rate still capped at α\alpha — a guarantee ordinary p-values lose the moment you peek more than once.

The classic mistake is treating an ordinary fixed-sample p-value as if it had this same anytime-valid property — recomputing it after every new data point and stopping as soon as it dips under 0.05. That practice, often called "optional stopping" or "peeking," can push the true false-positive rate far above the nominal level, because a p-value's 5% guarantee was only ever promised for a single, pre-planned look. If you want to monitor continuously, use an e-value or a properly constructed sequential test, not a repeatedly recomputed p-value.

Related concepts

Practice in interviews

Further reading

  • Ramdas, Grünwald, Vovk, Shafer, 'Game-Theoretic Statistics and Safe Anytime-Valid Inference'
  • Wasserman, Ramdas, Balakrishnan, 'Time-uniform, nonparametric, nonasymptotic confidence sequences'
ShareTwitterLinkedIn