Anytime-Valid Inference For Multinomial Count Data

Michael Lindon, Alan MalekNeurIPS 2022

Continuous monitoring of experiments is a common desire in industry, but traditional statistical methods make it surprisingly dangerous. This paper introduces a robust framework for "anytime-valid" sequential statistical testing of multinomial count data. By leveraging mixture martingales, the authors provide tools that allow researchers to continuously monitor experiments—such as A/B tests or software deployments—and stop as soon as a result is significant without inflating false-positive rates, even when underlying data rates change over time.

The Problem: "Peeking" and Non-Stationarity

In traditional "fixed-$n$" statistics, researchers must decide on a sample size before starting an experiment and only look at the data once. If you "peek" at the results early and stop because the p-value looks good, you significantly increase the risk of a Type I error (a false positive).

This limitation is a major headache for industry practitioners, such as the data science teams at Netflix, for two primary reasons:

  1. Optional Stopping: Businesses want to end losing experiments early to save money and scale winning ones immediately. Waiting for a fixed sample size is inefficient.
  2. Non-Stationarity: Real-world data is messy. Conversion rates on a website or error rates in software aren't constant; they fluctuate based on the time of day, day of the week, or external marketing pushes.

Existing sequential tests often struggle with this time-variability or require tracking "failures" (like users who didn't sign up), which can be technically difficult to log in real-time distributed systems.

Methodology: Mixture Martingales and Anytime-Validity

To solve these issues, the authors develop a sequential multinomial test using a mixture martingale construction.

  • The Statistic: They use a Bayes factor (comparing a null hypothesis to an alternative) as their test statistic. Specifically, they integrate the multinomial likelihood against a Dirichlet distribution.
  • Anytime-Validity: They prove this statistic is a non-negative martingale. Using Ville’s Inequality, they show that the probability of this statistic ever exceeding a threshold $1/\alpha$ is at most $\alpha$. This allows for a "sequential p-value" that remains valid no matter how many times you check the data.
Sequential p-value and Bayes Factor over time
  • The "Relative" Trick: To handle time-varying dynamics (non-stationarity), the framework focuses on the relative counts between different experimental groups (arms). If time-varying "nuisance" factors affect all arms equally, those factors mathematically cancel out when looking at the multinomial marks of the incoming data.
  • Bypassing the "Failure" Problem: In Bernoulli trials (like sign-ups), it's often hard to know exactly when a user didn't convert. By treating the stream of successes as a multinomial process, the authors create a test that only requires logging success events, making it much easier to implement in production systems.

Estimation: Anytime-Valid Confidence Sequences

Beyond simple hypothesis testing, the authors provide tools for estimation via "confidence sequences." Unlike standard confidence intervals, which are only valid at a predetermined sample size, these sequences are valid across all time steps.

Simultaneous Marginal Confidence Sequences

The authors demonstrate that these intervals can be calculated efficiently using convex optimization, allowing practitioners to maintain a running, accurate estimate of the true effect size as data flows in.

Real-World Impact and Key Results

The paper evaluates these methods using simulated data to prove false-positive control, alongside two high-impact real-world case studies at Netflix:

  1. Netflix Payment Funnel Experiment: In a conversion rate optimization test where success probabilities were clearly non-stationary, the anytime-valid test could have safely declared a winner in one week. A traditional fixed-sample test would have required nine weeks to reach the same conclusion without risking inflated error rates.
  2. Software Canary Testing: Using "Successful Play Starts" (SPS) events to monitor the health of new software versions in real-time, the method detected a significant performance regression (affecting ~60% of devices) in less than one second.

Ultimately, the authors show that their multinomial framework naturally extends to both Inhomogeneous Bernoulli processes (A/B testing) and Inhomogeneous Poisson processes (event rate monitoring), providing a single, unified mathematical tool for diverse problems.

Limitations and Future Directions

While the tests are highly practical, the authors note a few areas for future exploration:

  • Power Optimality: The authors do not formally study whether these are the fastest possible tests for a given statistical power.
  • Prior Sensitivity: The expected stopping time depends on the concentration parameters of the Dirichlet distribution. While "uniform" defaults work well, a prior that closely matches the expected effect size will result in faster stopping. More research is needed on tuning these for specific industry applications.
  • Integration with Bandits: A promising future direction is combining these confidence sequences with "Best Arm Identification" algorithms (like LUCB) to actively shift traffic toward the best-performing versions during the experiment, rather than just passively monitoring them.

Summary updated

BibTeX
@inproceedings{lindon2022anytime,
  author = {Michael Lindon and Alan Malek},
  title = {{Anytime-Valid Inference For Multinomial Count Data}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=a4zg0jiuVi},
}
Figure