Always-Valid p-values and the mSPRT
Summary
Johari, Pekelis & Walsh (2015; Operations Research 2022) keep the familiar -value interface but change its guarantee: an always-valid -value process satisfies at every stopping time , so users may watch the dashboard continuously and stop whenever they like. Theorem 1 shows such processes are in one-to-one correspondence with sequential tests that never accept (tests of power one). The recommended construction is Robbins’ mixture sequential probability ratio test (mSPRT): average the likelihood ratio over a prior on the alternative, reject when it exceeds , and publish . The mSPRT is first-order efficient for every user type simultaneously (Theorem 2), its mixing variance should roughly match the spread of true effects (Theorem 3), it beats a tuned fixed-horizon test on expected run time (Proposition 4), and its -values plug into Bonferroni and Benjamini–Hochberg (Sec. 7). It was deployed at Optimizely in January 2015.
Overview
The peeking problem arises because a fixed-horizon -value is super-uniform only at a pre-specified . Classical sequential tests fix this but behave like black boxes that emit one decision at one stopping time tailored to one user’s preferences. A platform serves thousands of users with unknown and heterogeneous trade-offs between power and run time, so Johari et al. ask for a streaming statistic that (i) controls type I error under any data-dependent stopping rule and (ii) leads each user, whatever her patience, to a near-optimal trade-off, without the platform knowing her preferences.
Main Content
Always validity and its duality with sequential tests
Always-valid p-value and confidence interval (Defs. 1-2) ^def-always-valid
A sequence of fixed-horizon -values is an always-valid -value process if for any (possibly infinite) stopping time with respect to ,
A sequence is an always-valid confidence interval process if for all and all stopping times .
Duality with sequential tests (Theorem 1, Proposition 1) ^thm-duality
- If is a sequential test, then is an always-valid -value process.
- Conversely, any always-valid yields a sequential test , .
- If is always valid for for each , then is an always-valid confidence interval process.
The proof of (1) is one line: nestedness gives for every , so .
The -value in (1) is monotone non-increasing in and is the a.s. smallest always-valid -value attached to that test. Monotone always-valid -values correspond one-to-one with sequential tests that “do not give up for failure” (). Operationally: the user stops whenever she wants and thresholds at her own . If she waits for she recovers the underlying sequential test; if she quits earlier she gives up power but never validity. Howard et al. (Lemma 3) show the stopping-time definition is equivalent to the uniform statement ; see Confidence Sequences.
The mSPRT
Mixture sequential probability ratio test (Sec. 5.2, Eqs. 7-9) ^def-msprt
Let data come from a one-parameter exponential family and let be a mixing distribution on with positive continuous density. With sample mean , the mixture likelihood ratio is
and the mSPRT is , . The associated always-valid -value is , .
Why the threshold is . Under each likelihood ratio is a non-negative martingale with mean one, and so is any mixture of them. Ville’s maximal inequality gives (the “standard martingale techniques” of Siegmund 1985 cited in the paper). Wald’s SPRT uses a single ; mixing over alternatives is what makes the test consistent against every :
Gaussian closed form. For and , carrying out the integral gives
(Derived here from Eq. 7 and checked numerically; the paper states the integral form only.) Setting and writing , gives the rejection boundary , which is exactly the two-sided normal mixture boundary of Howard et al.; see ^def-normal-mixture.
Efficiency for unknown users
Users are modelled as types: stop at the first with or at a maximum patience , whichever is first. Performance is the power profile and the relative run-length profile . The key asymptotic (Pollak & Siegmund 1975) is that for any , as ,
the inverse Kullback–Leibler divergence. Three regimes follow (Sec. 5.3): aggressive users () get , (Prop. 2); conservative users () get no power from any rule (Prop. 3); and for Goldilocks users ():
First-order efficiency (Theorem 2) ^thm-msprt-efficiency
Define the relative efficiency , the infimum over all feasible rules (, size ) that are at least as powerful at every . For any mixing distribution , if and with , then .
No competitor can be uniformly faster while being uniformly at least as powerful, and one statistic achieves this for all at once.
Choosing the mixing distribution (Theorem 3, Eq. 12) ^thm-mixing
If true effects follow a prior , the average relative run length is minimised to second order by , where is the set of detectable effects. For unit-variance normal data, and ,
The mixing variance is the prior variance of effects, corrected for truncation at : weight larger effects when samples are scarce and smaller effects when data are ample.
Simulations (Sec. 5.6.1) show robustness: misspecifying by one order of magnitude costs less than 5% average power and at most 10% run length; two orders of magnitude cost about 20% power and 40% run length. A platform can therefore fit empirically from its archive of past experiments, which is an empirical-Bayes step; the paper shrinks observed effects with James–Stein before fitting .
Against fixed horizon (Prop. 4). For a Goldilocks user, the expected relative run length of the truncated mSPRT divided by that of the fixed-horizon UMP test with the same average power tends to 0. On 10,000 real Optimizely experiments (Sec. 6.2, Fig. 5) the mSPRT usually finished before the fixed-horizon test calibrated to 80% average power; a user could beat it only by guessing the true effect to within about 50% relative error, which is “rarely achievable in practice”. Against other always-valid boundaries of the form (Robbins 1970; the LIL-based bound of Kaufmann et al. 2014), the tuned mSPRT had about 5% more power and 20-40% shorter run length at practical (Sec. 5.6.3): the LIL bound wins only asymptotically.
Two-stream A/B tests (Sec. 6.1)
Visitors are modelled as arriving in pairs , one per arm. For normal data with known common , is a one-parameter family for any value of the nuisance mean, so the Gaussian mSPRT applies with replaced by and gives exact uniform type I error control for the composite null . For Bernoulli data the pair does not reduce to a one-parameter family; the platform uses a CLT approximation with plug-in variance , which is only approximately always valid (accurate for small , where the test does not stop before the normal approximation kicks in).
Multiple testing (Sec. 7)
Evaluated at any stopping time, always-valid -values are a legitimate set of fixed-horizon -values. Hence Bonferroni (FWER) and BH under general dependence (BH-G, threshold ) commute with always validity (Props. 7-8), and dashboards can show always-valid -values. Plain BH under independence does not commute in general, because a stopping time that depends on all experiments correlates the -values; Theorem 5 gives a sufficient condition under which FDR is still controlled (it holds, for example, for “stop at the first time hypotheses are rejected”). Theorem 4 gives FCR-controlling corrected intervals: use level for rejected and for non-rejected experiments. See Multiple Testing Corrections.
Limitations (Larsen et al. Sec. 5)
Optimality is proven only for exponential families, which excludes the ratio metrics common in industry; the pairing of observations is artificial; repeated observations from one user violate independence; adaptive (bandit) allocation is not covered; and the estimate at the stopping time is biased even though the error rate is controlled. Extensions include bootstrap mSPRT for unknown likelihoods (Abhishek & Mannor 2017), multinomial mSPRT for sequential SRM detection (Lindon & Malek 2020), and the nonparametric generalisation in Confidence Sequences.
Examples
Simulation (own illustration). Unit-variance normal stream, , (threshold ), , 4,000 replications, checked after every observation.
| False positive rate under | 0.020 | 0.035 | 0.036 |
Naive continuous peeking gives 0.60 on the same data. With a true effect (the fixed-horizon test needs for 80% power) and : power by is 0.99, median stopping time 2,843, mean 3,359. About 55% of runs stop before the fixed-horizon ; the price of anytime validity is a right tail of longer runs, and the payoff is that large effects stop very early.
import numpy as np
def msprt_pvalues(x, sigma2, tau2, theta0=0.0):
"""Always-valid p-values for a N(theta, sigma2) stream, mixing N(theta0, tau2).
For a paired two-arm test pass x = y_treat - y_ctrl and sigma2 = 2 * sigma2_arm."""
n = np.arange(1, len(x) + 1)
xbar = np.cumsum(x) / n
log_lam = (0.5 * np.log(sigma2 / (sigma2 + n * tau2))
+ n**2 * tau2 * (xbar - theta0)**2 / (2 * sigma2 * (sigma2 + n * tau2)))
return np.minimum.accumulate(np.minimum(1.0, np.exp(-log_lam)))Connections
- The Peeking Problem and Optional Stopping — the problem this construction solves.
- Confidence Sequences — the interval-valued dual; Howard et al. generalise the Gaussian mSPRT to nonparametric sub-Gaussian and bounded data.
- Multiple Testing Corrections — Bonferroni and BH applied to always-valid -values.
- Power Analysis and Sample Size — the mSPRT replaces a pre-committed with a patience limit ; expected run time scales like .
- Multi-Armed Bandits and Thompson Sampling - Overview — the alternative when reward during the test matters more than inference; always-valid inference under adaptive allocation is left open by the paper.
- Empirical Bayes - Overview and James-Stein Estimator — how the mixing distribution is fitted from a portfolio of past experiments.
- Sequential and Adaptive BED — Bayesian sequential design; the mSPRT statistic is a Bayes factor with prior used with a frequentist threshold.