---
title: Anytime-Valid Confidence Sequences
url: https://www.emergentmind.com/topics/anytime-valid-confidence-sequences
type: topic
---

# Anytime-Valid Confidence Sequences

An anytime-valid confidence sequence is a sequence of random sets (typically intervals or regions) for unknown parameters, designed to guarantee prescribed coverage probability not just at a single, pre-chosen sample size but uniformly over all time points and all data-dependent stopping rules. This property prevents type-I error inflation caused by continuous monitoring (“peeking”) in sequential analyses, making confidence sequences fundamental to rigorous adaptive inference in modern statistical and machine learning applications.

## 1. Formal Structure and Coverage Guarantee

An anytime-valid confidence sequence (CS) for a functional $\theta=\phi(P)$, where $P$ is the data-generating law, is a sequence $\{C_t\}_{t\ge1}$ of (possibly random) sets such that
\[
\sup_{P\in\mathcal{P}}\,P\bigl(\exists\,t:\;\theta\notin C_t\bigr)\le\alpha.
\]
Equivalently, for every stopping time $\tau$—including any data-dependent rule—a uniformly valid CS satisfies
\[
P\bigl(\theta\in C_\tau\bigr)\ge 1-\alpha.
\]
This time-uniform coverage property immediately implies robust error control under optional stopping and continuation [2009.03167], [2210.01948]. In practical terms, the procedure remains valid regardless of when the user chooses to evaluate it, sidestepping inflated type-I error even under arbitrary peeking.

## 2. Martingale Foundations and Ville’s Inequality

The rigorous construction and justification of anytime-valid CSs fundamentally depend on nonnegative martingales or supermartingales. Suppose $\{M_t\}$ is a nonnegative supermartingale adapted to the data filtration, starting at $M_0=1$. Ville’s inequality states that for any $\alpha>0$,
\[
P\Bigl(\sup_{t\ge0}M_t\ge 1/\alpha\Bigr)\le\alpha,
\]
uniformly over all underlying laws $P$ and all stopping times [2009.03167]. For parametric or function-indexed models, a family of nonnegative martingales $\{M_t^\theta\}_{\theta\in\Theta}$ can be constructed such that the CS is the set of parameters not yet “rejected”:
\[
C_t = \bigl\{\theta:\sup_{s\le t}M_s^\theta < 1/\alpha\bigr\}.
\]
Admissibility theory shows that all admissible anytime-valid confidence sequences must arise (possibly up to null-set modifications) as inversions of such martingale-based sequential tests; no other approach avoids being dominated or strictly improved upon without leaking type-I error [2009.03167].

## 3. Construction Methods and Key Examples

The method of constructing CSs depends on the problem structure:

- **Exponential Martingales:** For sub-Gaussian or bounded support data, use exponential martingales. For mean estimation, $M_t(\mu; \lambda) = \exp\left(\lambda S_t - \frac{\lambda^2}{2} t \sigma^2\right)$, with $S_t = \sum_{i=1}^t (X_i-\mu)$, where mixing over $\lambda$ yields optimal nonasymptotic CSs [2210.01948], [2009.03167].
- **Mixture Martingales:** Mixtures over $\mu$, $\lambda$, or other tilting parameters yields closed-form CSs with coverage exact for all $t$ [2210.01948].
- **Composite Nulls and Functionals:** For functionals or composite null models, pointwise martingales and their aggregates (max- or mixture-martingales) underpin admissible CSs [2009.03167].
- **Sequential Testing Duality:** Inversion of martingale-based sequential tests yields CSs; conversely, leaving a CS implies rejection of corresponding parameter hypotheses [2502.10380].

**Examples:** For a sub-Gaussian mean, a universal CS is
\[
\left[\bar{X}_t \pm \sqrt{\frac{t+1}{t} \frac{\ln((t+1)/\alpha^2)}{t}}\right]
\]
holding uniformly over $t$ [2009.03167].

## 4. Admissibility, Optimality, and Improvements

Ramdas et al. [2009.03167] comprehensively analyze admissibility: a CS is inadmissible if it is strictly dominated by another CS that is uniformly tighter (i.e., smaller at all times, strictly smaller at some time, with equal or better error control). The main results include:

- **Max-martingale construction:** For singleton nulls, admissibility is characterized via Doob–Lévy max-martingales.
- **Composite nulls and dominance:** Any admissible CS for composite nulls is constructed by “pasting” together admissible martingales for point nulls, extended via transfinite induction and domination arguments.
- **Extensions to e-processes and p-processes:** Any admissible e-process or p-process likewise must be based on nonnegative (super)martingales, with the Snell envelope and Doob decomposition providing the formal links.
- **Sub-Gaussian supermartingale optimality:** The classical sub-Gaussian exponential supermartingale is shown to be admissible—no alternative can strictly improve its performance without losing validity [2009.03167].

The universal principle established is:
> “Admissible anytime-valid sequential inference for testing or confidence must be built from nonnegative martingales—explicitly for e-values and tests, or implicitly (via inversion) for p-values and confidence sequences. No other structure can uniformly dominate martingale-based procedures without violating validity.” [2009.03167]

## 5. Practical Implementation Strategies

Typical recipes to implement CSs from martingales:

1. **Choice of family:** Select a martingale or supermartingale family satisfying the required conditional mean or moment generating function constraints for the null hypothesis.
2. **Mixing distributions:** When necessary, mix over priors (e.g., Gaussian for normal means), yielding mixture martingales with tight finite-sample bounds.
3. **Boundary inversion:** At each time $t$, invert $M_t(\theta) < 1/\alpha$ to obtain $C_t$; extract endpoints or regions as needed.
4. **Sequential algorithms:** For parameter grids, vectorize martingale updates; use FFT or precomputed log-masses for efficiency.
5. **Monitoring and reporting:** Report the intersection of all CSs across $t$ or signal crossings when a parameter is excluded.
6. **Implementation tips:** Exploit models’ structure for computational savings, maintain running maxima/minima, and adapt mixing for variance or prior knowledge.

## 6. Illustrative Applications and Extensions

- **Classical mean estimation:** Sub-Gaussian CSs, e.g., $\left[\bar X_t \pm \sqrt{\frac{t+1}{t} \ln((t+1)/\alpha^2)/t}\right]$ [2009.03167], remain tight and admissible relative to classical fixed-horizon methods.
- **Symmetry testing:** Recent constructions demonstrate domination over earlier NSM-based methods—they yield strictly narrower CSs under symmetry alternatives [2009.03167].
- **Composite and nonparametric inference:** Martingale-based CSs extend to testing symmetry, quantiles, functionals, through appropriate exponential or mixture martingale designs, supporting parametric and nonparametric sequential inference [2210.01948].
- **Adaptive inference in streaming and sequential decision making:** Martingale-based CSs are the foundational tools for robust adaptive statistical inference under sequential data acquisition, continuous monitoring, and arbitrary data-dependent stopping [2009.03167], [2210.01948].

## 7. Fundamental Insights and Limitations

Every admissible, anytime-valid sequential inference procedure—be it for confidence intervals, p-processes, or e-processes—must fundamentally leverage nonnegative (super)martingales. No alternative procedure is universally valid, dominates, or is strictly tighter without risk of type-I error inflation. Advanced martingale constructions (max-martingales, Snell envelopes, Doob decomposition, transfinite induction) are necessary for rigorous admissibility theory in composite and nonparametric cases [2009.03167]. Practical implementation reduces to inversion of uniformly valid martingale-based tests, and all extensions—functionals, symmetry, regression, adaptive algorithms—remain tied to martingale theory at their core.

Source: https://www.emergentmind.com/topics/anytime-valid-confidence-sequences