Algorithm Search⌘K

Definitionresearch

Test martingale

Also called nonnegative supermartingale test.

A nonnegative process that starts at 1 and is a martingale (or supermartingale) under the null. It is the wealth of a bettor against the null and can be checked at any time.

A test martingale for a null hypothesis is a martingale (Mt)t≥0(M_t)_{t \ge 0} that starts at M0=1M_0 = 1 and never takes a negative value under every distribution of the null. Its value is the wealth of a bettor who starts with one unit and makes fair bets against the null, so a large value is evidence against the null. By Ville's inequality the process ever reaches 1/α1/\alpha with null probability at most α\alpha, so a test that rejects at that level is valid no matter when the analyst looks or stops. The value at any stopping time is an e-variable.

Definition

Let X1,X2,…X_1, X_2, \ldots be observations, let Ft=σ(X1,…,Xt)\mathcal F_t = \sigma(X_1, \ldots, X_t) with F0\mathcal F_0 trivial, and let H0\mathcal H_0 be a set of distributions of the sequence, the null hypothesis.

Test supermartingale. A process (Mt)t≥0(M_t)_{t \ge 0} is a test supermartingale for H0\mathcal H_0 when, for every P∈H0P \in \mathcal H_0:

  1. MtM_t is Ft\mathcal F_t-measurable with values in [0,∞)[0, \infty) for every t≥0t \ge 0;
  2. M0=1M_0 = 1;
  3. EP[Mt∣Ft−1]≤Mt−1E_P[M_t \mid \mathcal F_{t-1}] \le M_{t-1} for every t≥1t \ge 1, PP-almost surely.

Test martingale. It is a test martingale when the inequality in 3 is an equality for every P∈H0P \in \mathcal H_0. For a simple null H0={P}\mathcal H_0 = \{P\} this is the definition of Shafer, Shen, Vereshchagin and Vovk (2011): a nonnegative PP-martingale with initial value 1.

Limit and stopped value. A nonnegative supermartingale converges almost surely, so M∞=lim⁡t→∞MtM_\infty = \lim_{t \to \infty} M_t exists PP-almost surely. For a stopping time τ\tau, possibly infinite, MτM_\tau means M∞M_\infty on {τ=∞}\{\tau = \infty\}.

Every test supermartingale is an e-process. A process (Et)(E_t) is an e-process for H0\mathcal H_0 when EP[Eτ]≤1E_P[E_\tau] \le 1 for every P∈H0P \in \mathcal H_0 and every stopping time τ\tau. A test supermartingale has this property. Fix P∈H0P \in \mathcal H_0 and a stopping time τ\tau. For each nn, τ∧n\tau \wedge n is a bounded stopping time, so the optional stopping theorem for supermartingales gives EP[Mτ∧n]≤EP[M0]=1E_P[M_{\tau \wedge n}] \le E_P[M_0] = 1. As n→∞n \to \infty, Mτ∧n→MτM_{\tau \wedge n} \to M_\tau almost surely, and Fatou's lemma, which needs M≥0M \ge 0, gives EP[Mτ]≤lim inf⁡nEP[Mτ∧n]≤1E_P[M_\tau] \le \liminf_n E_P[M_{\tau \wedge n}] \le 1. So MτM_\tau is an e-variable for every stopping time τ\tau.

The converse is false. If for each P∈H0P \in \mathcal H_0 the process MPM^P is a test martingale for {P}\{P\}, then Et=inf⁡P∈H0MtPE_t = \inf_{P \in \mathcal H_0} M^P_t satisfies EP[Eτ]≤EP[MτP]≤1E_P[E_\tau] \le E_P[M^P_\tau] \le 1, so it is an e-process, but in general it is not a supermartingale under any PP. Ramdas, Ruf, Larsson and Koolen (2022) use such processes to test exchangeability, a composite null for which test supermartingales are weak. So "e-process" is the wider class, not a second name for this one.

Anytime-valid p-value. The process pt=min⁡(1,1/max⁡s≤tMs)p_t = \min\bigl(1, 1/\max_{s \le t} M_s\bigr) is nonincreasing, and by Ville's inequality P(∃t:pt≤α)≤αP(\exists t: p_t \le \alpha) \le \alpha for every P∈H0P \in \mathcal H_0 and every α∈(0,1]\alpha \in (0, 1].

Construction by betting. Most test martingales are running products. Let qtq_t be a density that depends only on X1,…,Xt−1X_1, \ldots, X_{t-1} (a predictable bet), and let H0={P}\mathcal H_0 = \{P\} with conditional density pt(⋅∣Ft−1)p_t(\cdot \mid \mathcal F_{t-1}) positive where qtq_t is. Then

Mt=∏i=1tqi(Xi)pi(Xi)M_t = \prod_{i=1}^t \frac{q_i(X_i)}{p_i(X_i)}

is a test martingale, because EP[qt(Xt)/pt(Xt)∣Ft−1]=∫qt=1E_P[q_t(X_t)/p_t(X_t) \mid \mathcal F_{t-1}] = \int q_t = 1. For observations in [0,1][0, 1] with null mean μ0\mu_0, the product ∏i≤t(1+λi(Xi−μ0))\prod_{i \le t}(1 + \lambda_i (X_i - \mu_0)) with predictable λi∈[−1/(1−μ0),1/μ0]\lambda_i \in [-1/(1 - \mu_0), 1/\mu_0] is a test martingale for the whole composite null "the conditional mean is μ0\mu_0": each factor is nonnegative and has conditional mean 1. A mixture ∫Mt(λ) π(dλ)\int M^{(\lambda)}_t\,\pi(d\lambda) of test martingales with a prior π\pi fixed in advance is again a test martingale, by Fubini's theorem.

Examples and non-examples

A likelihood ratio on a coin. Test the fair coin, PP: the flips are i.i.d. with heads probability 1/21/2, against the bet qq: heads with probability 0.70.7. A head multiplies the wealth by 0.7/0.5=1.40.7/0.5 = 1.4 and a tail by 0.3/0.5=0.60.3/0.5 = 0.6. The conditional mean of a factor under PP is 12(1.4)+12(0.6)=1\tfrac12(1.4) + \tfrac12(0.6) = 1. On the flips HHTHHHTH:

tt 1 2 3 4 5 6 7 8
flip H H T H H H T H
MtM_t 1.4 1.96 1.176 1.6464 2.3050 3.2269 1.9362 2.7106

So M8=1.46⋅0.62=1058841/390625≈2.7106M_8 = 1.4^6 \cdot 0.6^2 = 1058841/390625 \approx 2.7106. The largest value is M6≈3.2269M_6 \approx 3.2269, so the anytime-valid p-value after eight flips is 1/3.2269≈0.311/3.2269 \approx 0.31. Rejecting the fair coin at α=0.05\alpha = 0.05 needs Mt≥20M_t \ge 20.

The Gaussian exponential martingale. For i.i.d. N(0,1)N(0, 1) data with sum StS_t and a fixed λ\lambda, the process Mt=exp⁡(λSt−λ2t/2)M_t = \exp(\lambda S_t - \lambda^2 t/2) is a test martingale for H0={N(0,1)∞}\mathcal H_0 = \{N(0,1)^\infty\}, since E[eλX−λ2/2]=1E[e^{\lambda X - \lambda^2/2}] = 1. Mixing over λ∼N(0,ρ2)\lambda \sim N(0, \rho^2) gives the normal mixture (1+tρ2)−1/2exp⁡(ρ2St2/(2(1+tρ2)))(1 + t\rho^2)^{-1/2}\exp\bigl(\rho^2 S_t^2 / (2(1 + t\rho^2))\bigr), which is the statistic of the mixture SPRT and of a normal confidence sequence.

A Bayes factor. For a simple null P0P_0 and a prior π\pi on alternatives PθP_\theta fixed before the data, the Bayes factor ∫∏i≤tpθ(Xi) π(dθ)/∏i≤tp0(Xi)\int \prod_{i \le t} p_\theta(X_i)\,\pi(d\theta) / \prod_{i \le t} p_0(X_i) is a test martingale for P0P_0. Shafer et al. (2011) discuss this link.

Non-example: the missing drift term. Mt=exp⁡(λSt)M_t = \exp(\lambda S_t) with λ≠0\lambda \ne 0 is nonnegative and starts at 1, but E[Mt]=eλ2t/2>1E[M_t] = e^{\lambda^2 t/2} > 1 for t≥1t \ge 1. It is a submartingale, and a rule that rejects when it exceeds 1/α1/\alpha has no level-α\alpha guarantee.

Non-example: a bet placed after the outcome. On the coin, let the bettor pick the side after seeing the flip: the factor is 1.4 whatever happens, so Mt=1.4tM_t = 1.4^t. Here qtq_t depends on XtX_t, so it is not predictable, and EP[Mt]=1.4tE_P[M_t] = 1.4^t.

Non-example: the wrong start. A nonnegative martingale with M0=2M_0 = 2 satisfies only P(sup⁡tMt≥1/α)≤2αP(\sup_t M_t \ge 1/\alpha) \le 2\alpha. Dividing by 2 gives a test martingale.

Non-example: the running maximum. max⁡s≤tMs\max_{s \le t} M_s is nonnegative and starts at 1, but it is a submartingale, not a supermartingale. On the coin it is 3.2269 at t=8t = 8 while M8=2.7106M_8 = 2.7106. Its reciprocal is still the anytime-valid p-value above, because the guarantee comes from Ville's inequality on MM.

  • E-variable. An e-variable is one nonnegative statistic with null mean at most 1. A test supermartingale gives one at every stopping time, as shown above.
  • E-process. The wider class of processes with EP[Eτ]≤1E_P[E_\tau] \le 1 for all stopping times and all null PP. Every test supermartingale is an e-process; the infimum construction above gives e-processes that are not supermartingales (Ramdas et al. 2022, 2023).
  • Martingale. A test martingale is a martingale under each null distribution, with the two extra conditions M0=1M_0 = 1 and Mt≥0M_t \ge 0.
  • Ville's inequality. Ville's inequality is the time-uniform bound P(sup⁡tMt≥1/α)≤αP(\sup_t M_t \ge 1/\alpha) \le \alpha that turns a test supermartingale into a sequential test.
  • Sequential tests. The log of the SPRT statistic is the log of a likelihood-ratio test martingale; the mixture SPRT uses a mixture; a confidence sequence collects the parameter values whose test martingale stays below 1/α1/\alpha.
  • Growth rate. Let the data be i.i.d. from QQ and let the bet be a fixed density qq. By the law of large numbers, 1tlog⁡Mt→EQ[log⁡(q/p)]=D(Q ∥ P)−D(Q ∥ q)\frac1t \log M_t \to E_Q[\log(q/p)] = D(Q \,\|\, P) - D(Q \,\|\, q) almost surely, with DD the Kullback-Leibler divergence. The rate is largest, equal to D(Q ∥ P)D(Q \,\|\, P), when the bet is q=Qq = Q. This is the reason to bet with a good guess of the alternative.

References

  1. Glenn Shafer, Alexander Shen, Nikolai Vereshchagin and Vladimir Vovk, Test martingales, Bayes factors and p-values, Statistical Science 26(1) (2011), pages 84 to 101, the definition of a test martingale, its relation to Bayes factors and p-values, and the history of the idea from Ville
  2. Aaditya Ramdas, Peter Grünwald, Vladimir Vovk and Glenn Shafer, Game-theoretic statistics and safe anytime-valid inference, Statistical Science 38(4) (2023), pages 576 to 601, test martingales, test supermartingales and e-processes for composite nulls, and testing by betting
  3. Aaditya Ramdas, Johannes Ruf, Martin Larsson and Wouter M. Koolen, Testing exchangeability, fork-convexity, supermartingales and e-processes, International Journal of Approximate Reasoning 141 (2022), pages 83 to 109, e-processes that are not supermartingales, and the test of exchangeability where they are needed
  4. Steven R. Howard, Aaditya Ramdas, Jon McAuliffe and Jasjeet Sekhon, Time-uniform Chernoff bounds via nonnegative supermartingales, Probability Surveys 17 (2020), pages 257 to 317, nonnegative supermartingales built from exponential and mixture constructions, with Ville's inequality

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/8V449R/text.yaml