Recently, I've become interested in anytime-valid inference, especially e-values. I think the ideas are cool and useful, both in theory and in practice, so I'm planning to learn more about them whenever I have some spare time (mostly for fun).
These notes are mainly based on Aaditya Ramdas's lecture slides and the book by Ramdas and Wang [1], which are great resources for self-study.
1. Revisiting Hypothesis Testing
For some of the concepts in mathematical statistics, I usually refer to Statistical Inference by George Casella and Roger Berger. It's a well written textbook that's easy to follow even without a strong background in measure theory.
Suppose that X1,X2,…∼iidPθ for θ∈Θ. Consider the hypothesis testing problem
H0:θ∈Θ0vs.H1:θ∈Θ1,
where Θ0∩Θ1=∅. Let X1:t=(X1,…,Xt) be the observed sample.
Definition 1 (Test)
A test is a function ϕ:Xt→[0,1], where ϕ(X1:t) is the probability of rejecting H0 given the observed sample.
The power function of ϕ is the probability of rejecting H0 under Pθ:
γϕ(θ)=Eθ[ϕ(X1:t)].
The size of ϕ is defined as
size(ϕ)=θ∈Θ0supγϕ(θ).
A test ϕ is called a level-α test if size(ϕ)≤α.
In other words, a level-α test rejects H0 with probability at most α when H0 is true.
Definition 2 (p-value)
A statistic pt(X1:t)∈[0,1] is called a p-value for H0 if
Pθ(pt(X1:t)≤α)≤α
for every θ∈Θ0 and α∈(0,1).
Given a p-value pt, we obtain a level-α test by
ϕ(X1:t)=I{pt(X1:t)≤α}.
That is, we reject H0 whenever the p-value is smaller than or equal to α.
2. Sequential hypothesis testing
In classical testing, the sample size is fixed in advance. In sequential testing, we collect data until we have enough evidence to make a decision.
Definition 3 (Stopping time)
A random time τ∈N∪{∞} is called a stopping time if {τ≤t}∈Ft for every t≥0.
Suppose that pt is a valid p-value at each time t. Consider the stopping rule
τ=inf{t≥1:pt≤α}.
Is the resulting test still valid..?
Example 1
Suppose under null hypothesis, p1,p2,…∼iidUnif(0,1). Although each pt is a valid p-value,
Thus, we can reject H0 whenever Wt≥1/α. If H0 is true, it should be difficult for the bettor to make a large amount of money. If the bettor makes a lot of money, we have some evidence against H0.
6. What is a good betting strategy?
There are many valid betting strategies. For example, we can choose not to bet at all:
Bt=1,t≥1.
Then Wt=1 for every t≥0. This strategy is valid but provides no evidence against H0. We can also bet all our money at each round. This is also valid, but a single loss wipes out our entire wealth.
We want a betting strategy that is valid under H0 but makes money quickly under H1. For simplicity, consider two simple hypotheses:
The remaining question is how to choose b so that the wealth grows quickly under H1.
Since the wealth is updated multiplicatively, it is natural to consider its logarithm (Why? Because taking the log turns a product into a sum and lets us use the law of large numbers.):
Moreover, assuming Eθ1[∣logb(X)∣]<∞, the SLLN gives
t1logWt=t1s=1∑tlogb(Xs)a.s.Eθ1[logb(X)].
Then, for large t,
logWt≈tEθ1[logb(X)],
or equivalently,
Wt≈exp(tEθ1[logb(X)]).
Thus, Eθ1[logb(X)] determines the long-run exponential growth rate of the wealth. We would like to make this quantity as large as possible while keeping the betting strategy valid under H0.
7. Kelly optimality
The idea of maximizing the expected logarithmic growth of wealth is known as the Kelly criterion.
Definition 8 (Kelly optimality)
A betting function b⋆:X→[0,∞) is called Kelly-optimal if it solves
b≥0maxsubject toEθ1[logb(X)]Eθ0[b(X)]≤1.
The constraint makes the betting strategy valid under H0, while the objective makes the wealth grow as fast as possible under H1.
What is the solution to this optimization problem?Interestingly, the solution is something we are already familiar with from classical hypothesis testing.
Theorem 3 (A simplified version of Theorem 3.20 in [1]; see also [3])
Let pθ0 and pθ1 be the densities of Pθ0 and Pθ1, respectively. Suppose that Pθ1≪Pθ0 and DKL(Pθ1∥Pθ0)<∞.
Then the likelihood ratio
b⋆(x)=pθ0(x)pθ1(x)
is Kelly-optimal. Moreover, the optimal logarithmic growth rate is
Eθ1[logb⋆(X)]=DKL(Pθ1∥Pθ0).
Proof
For simplicity, we give the proof for continuous distributions. (no measure theoretic notation here.) First, we check that b⋆ is a valid betting function:
It is interesting that we obtain the same likelihood ratio by maximizing power in classical testing (Neyman–Pearson lemma) and log-wealth growth in betting.
8. Sequential likelihood ratio test
Now that we know the Kelly-optimal betting function, we can use it at every round:
Under mutual absolute continuity, (Lt) and (1/Lt) are nonnegative martingales under H0 and H1, respectively. Applying Ville's inequality to both processes gives
Pθ0(Reject H0)Pθ1(Accept H0)≤α,≤β.
References
[1] Aaditya Ramdas and Ruodu Wang (2025). Hypothesis testing with e-values. Foundations and Trends in Statistics, 1(1–2), 1–390
[2] Jean Ville (1939). Etude critique de la notion de collectif. Gauthier-Villars, Paris, 3
[3] Glenn Shafer (2021). Testing by betting: A strategy for statistical and scientific communication. Journal of the Royal Statistical Society: Series A, 184(2), 407–431
[4] Abraham Wald (1945). Sequential tests of statistical hypotheses. The Annals of Mathematical Statistics, 16(2), 117–186