Theory¶
This page summarises why the guarantees of anywatch hold. See References for the full treatment.
The problem with repeated looks¶
Suppose a classical test at level 0.05 is applied every day to the accumulated data. Even when the model is performing as declared, the probability that some day produces a rejection grows with the number of days and approaches one. Post-market monitoring, which by definition looks repeatedly, needs a different kind of test.
E-values and e-processes¶
An e-value is a nonnegative statistic \(E\) with \(\mathbb{E}[E] \le 1\) under the null hypothesis. Markov's inequality gives \(P(E \ge 1/\alpha) \le \alpha\).
An e-process is a sequence \(E_1, E_2, \dots\) that is an e-value at every stopping time. The e-processes in anywatch are nonnegative supermartingales with \(E_0 = 1\), and Ville's inequality gives
This single inequality is the reason why anywatch can be inspected at any time without inflating the error.
Testing by betting¶
For observations \(X_t \in [0, 1]\) and the null \(\mu \le m\), imagine a gambler who starts with one unit of wealth and at each step bets a fraction \(\lambda_t\) on the outcome \(X_t - m\):
If \(\lambda_i\) depends only on the past, then under the null each factor has conditional expectation at most one, so \(K_t\) is a nonnegative supermartingale. Large wealth is evidence against the null. anywatch uses the approximate GRAPA rule
truncated to a fraction of the admissible range, which approximately maximises the growth rate of the wealth under the alternative.
Confidence sequences¶
Inverting a family of tests gives a confidence sequence: the set of means \(m\) not rejected at time \(t\). Because each test controls its error uniformly over time, the confidence sequence satisfies
BettingCS does exactly this on a grid of candidate means.
EmpiricalBernsteinCS uses a closed form bound derived from a
supermartingale with an empirical variance correction.
Multiple subgroups¶
With \(K\) subgroups each tested at level \(\alpha / K\), the union bound and Ville's inequality give a family-wise guarantee over all groups and all times. The e-Benjamini-Hochberg procedure rejects the \(k^*\) largest e-values, where \(k^* = \max\{k : e_{(k)} \ge K / (\alpha k)\}\), and controls the false discovery rate under arbitrary dependence.
Change detection with e-detectors¶
For a change that may occur at an unknown time, the Shiryaev-Roberts recursion
sums e-processes started at every possible change point. Under no change \(\mathbb{E}[R_t] \le t\), and the first time \(R_t\) exceeds a threshold \(c\) has expectation at least \(c\). anywatch averages this recursion over a grid of bet sizes, which preserves the guarantee.
Assumptions¶
The guarantees require that observations lie in the stated bounds and that the null hypothesis holds conditionally on the past at every step. They do not require independence, identical distribution or large samples. For the drift detectors the reference summary is treated as known; with a large reference sample the effect of estimating it is negligible.