#421Sequential Test (mSPRT-Style Always-Valid p-Value)HardStatisticsAsked atMicrosoft · Meta · Google
Sequential Test (mSPRT-Style Always-Valid p-Value)
Background
Standard A/B tests with peeking inflate Type-I error. mSPRT-style always-valid p-values let an experimenter check the running result at any time without the false-positive rate exceeding . The kernel: at each step, compute a -statistic on the running differences; map to a bounded via .
Problem statement
Implement running_avalp(differences) returning a list of always-valid -values, one per step:
Input
differences—list[float], the per-step paired differences (treatment − control).
Output
Returns list[float] of length len(differences), each in .
Examples
Example 1 — all-zero stream
Input: [0.0, 0.0, ..., 0.0]
Output: all 1.0
Example 2 — strong signal eventually crosses 0.05
Input: [1.0] * 100
Output: at some n, p < 0.05; stays below thereafter
Example 3 — n=1 special case
Input: [0.5]
Output: [1.0] # no variance estimate yet, return 1
Constraints
- → return
1.0for that step. - Empty input → empty list.
- All p-values bounded in .
Notes
- Why this is "always valid". Peeking-safe means — the false-positive rate at any stopping time is bounded. The exponential bound comes from mSPRT theory.
- vs fixed-horizon. Always-valid -values are typically 1.5–3× higher than fixed-horizon -values at the planned sample size. Tradeoff: peeking flexibility for some power.
Python
Loading...
▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.
- •Reference three step
- •Sample five step
- •Example four ramp