Optimal Anytime-Valid Tests for Composite Nulls

Shubhanshu ShekhararXiv 2025 · DOI

Introduction

In modern data science applications such as A/B testing and clinical trials, researchers often need to monitor data as it arrives and stop as soon as sufficient evidence is gathered. This practice, known as "anytime-valid" inference, requires statistical tests that maintain valid error rates regardless of when the experimenter chooses to stop. While classical fixed-sample tests are well-understood, designing sequential tests for composite null hypotheses—where the null is a set of distributions rather than a single point—presents significant challenges.

This work provides a constructive framework for designing sequential hypothesis tests that are "first-order optimal" for composite nulls. By leveraging the Donsker-Varadhan representation of KL divergence and minimax theorems, the framework develops $e$-processes that match fundamental information-theoretic lower bounds on stopping times, extending these results from simple finite alphabets to complex nonparametric models.

Methodology

The core of the proposed approach is the construction of $e$-processes. An $e$-process is a sequence of random variables whose expectation is at most 1 under any distribution in the null hypothesis. These processes act as "evidence trackers," allowing for valid stopping at any time via Ville’s Inequality. To achieve optimality, the framework integrates three primary mathematical components:

  1. Donsker-Varadhan (DV) Representation: This transforms the Kullback-Leibler (KL) divergence into a "saddle-point" optimization problem over a class of test functions.
  2. Sion’s Minimax Theorem: This allows for swapping the order of minimization over the null class and maximization over test functions, identifying an "oracle" evidence tracker.
  3. Predictable Empirical Risk Minimization (ERM): Since the oracle function is unknown a priori, the test learns it sequentially. At each step $n$, the test selects a function that would have performed best on the previous $n-1$ observations.
The diagram illustrates the transformation of probability laws under a test function $\psi$ and stopping time $\tau_\alpha$, highlighting the mapping from the original laws $P$ and $Q$ to the law of the test statistic.

The framework is first established for the Finite Alphabet Case and subsequently generalized to General Alphabets, including nonparametric settings such as Hölder smooth density models.

Key Insights and Ideas

The "Oracle" Connection

The research demonstrates that the optimal evidence for a composite null is essentially a ratio between a "universal" predictor and the "running Maximum Likelihood Estimate (MLE)" of the null class. This provides a clear target for constructing practical test statistics.

Bridging Theory and Practice

By framing the test as a saddle-point problem, the author connects sequential testing to the mathematical structures used in Generative Adversarial Networks (GANs). Specifically, the "critic" in an $f$-GAN performs a task analogous to what an optimal anytime-valid test requires, suggesting that neural network architectures could be used to implement these tests in high-dimensional settings.

Sharp Constants

Unlike previous work that achieved optimality only up to a constant factor, this construction ensures that the ratio of the expected stopping time to the theoretical lower bound converges exactly to 1 as the error tolerance $\alpha$ approaches zero.

Key Results

  • Theorem 2.1 (Finite Case): Proves that for finite alphabets, a test based on the ratio of a universal mixture to the null MLE is first-order optimal.
  • Theorem 3.1 (General Case): Establishes that for general alphabets, if the class of test functions is "learnable" and the null class is weakly compact and convex, the DV-based $e$-process is optimal.
  • Computational Heuristics: For high-dimensional data (e.g., images), the paper suggests using neural networks and $f$-GAN training pipelines to implement these optimal tests heuristically.

Limitations and Future Work

While theoretically robust, the proposed optimal tests require solving an optimization problem at every time step, which can be computationally intensive. Future work may explore iterative solvers, such as stochastic average approximation, to update test functions incrementally. Additionally, while the current proofs rely on the independent and identically distributed (i.i.d.) assumption, extending these results to dependent data like time series remains an important open direction.

Summary updated

BibTeX
@misc{shekhar2025optimal,
  author = {Shubhanshu Shekhar},
  title = {{Optimal Anytime-Valid Tests for Composite Nulls}},
  year = {2025},
  eprint = {2512.20039},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.20039},
}
Figure