Sequential Kernel Goodness-of-fit Testing

Zhengyu Zhou, Weiwei LiuICML 2024

Overview

This paper introduces a novel framework for sequential goodness-of-fit testing, enabling researchers to monitor streaming data and halt data collection as soon as sufficient evidence accumulates to reject a null hypothesis. By integrating the "testing by betting" principle with Kernel Stein Discrepancy (KSD), the authors develop a test that is more powerful and adaptive than traditional batch methods—even when the target distribution is only known up to a normalization constant.

The Problem with Batch Testing

In classical statistics, goodness-of-fit tests determine whether a set of data points likely originated from a specific target distribution. However, traditional tests (such as the Kolmogorov-Smirnov test) are designed for batch settings, where the sample size must be fixed before observation begins.

In real-world scenarios, data often arrives in streams. If a researcher "peeks" at the accumulating results and decides to stop early based on observed trends, they violate the fundamental assumptions of batch tests. This practice inflates the "false alarm" rate (Type-I error). While corrections like the Bonferroni method exist, they are notoriously conservative, requiring massive amounts of data to reach a conclusion and effectively crippling the test's statistical power.

To overcome this, the authors design a test that is:

  1. Sequential: Capable of running continuously as new data arrives.
  2. Adaptive: Able to stop quickly for "easy" problems (where distributions differ vastly) while taking longer for "hard" ones.
  3. Non-parametric: Effective for complex, high-dimensional distributions without requiring knowledge of their normalization constants (a frequent hurdle in Bayesian inference).

Methodology: Testing by Betting

The authors propose the Sequential Kernel Goodness-of-fit Test (SKGT). The core innovation lies in merging two powerful statistical concepts:

  1. Testing by Betting: Instead of calculating a traditional p-value, the test is framed as a game. A fictitious bettor starts with a baseline wealth (e.g., $1) and bets against the null hypothesis. If the null is false, the bettor's wealth grows. If the wealth hits a predefined threshold (e.g., $20 for a 5% significance level), the null hypothesis is rejected. This framework naturally accommodates "peeking" because the wealth process is a martingale—it remains fair under the null regardless of the stopping time.
  2. Kernel Stein Discrepancy (KSD): To determine how to bet, the authors employ KSD. KSD uses a "Stein operator" and a "kernel function" to measure the distance between the incoming data and the target distribution. Crucially, it only requires the derivative of the log-density of the target, bypassing the need to compute the partition function (the normalization constant).

Additionally, the authors utilize the Online Newton Step (ONS) strategy to dynamically update the "betting fraction"—the portion of current wealth to wager at each step—maximizing the rate of wealth growth.

Experimental Setup

The method was evaluated using synthetic simulations designed to test specific mathematical properties across different domains:

  • Student's $t$ vs. Normal Distributions: A standard benchmark for continuous data.
  • Ising Model: A classic physics and machine learning model used to validate the discrete version of the test (KDSD).
  • Truncated Gaussians in a Unit Ball: Used to test the bounded-domain version of the test (bd-KSD).

Key Results and Insights

Lower Sample Requirements: In simulations, the SKGT rejected the null hypothesis significantly faster than batch tests using Bonferroni corrections. As the problem became easier (e.g., higher $\beta$ values indicating greater divergence from the null), the SKGT's average stopping time dropped sharply, whereas corrected batch tests remained stagnant and inefficient.

Average Stopping Time vs. Beta

Rigorous Error Control and Power: Across all experiments, the test never exceeded the pre-set significance level $\alpha$, confirming that the "testing by betting" framework successfully prevents false alarms during continuous monitoring. Furthermore, the test demonstrates strong statistical power that scales predictably with sample size and problem difficulty (such as varying degrees of freedom in Student's $t$ distributions).

Power vs. Sample Size for varying degrees of freedom

Wealth as Evidence: The most intuitive takeaway is that accumulated wealth serves as a direct measure of evidence against the null. If the betting strategy is sound and wealth grows exponentially (the fastest possible rate for this type of sequential test, as proven by the authors), the null hypothesis is almost certainly false.

Handling Boundaries and Discrete Spaces: While standard KSD assumes data lives in an infinite, continuous space, this paper successfully extends the sequential betting framework to discrete spaces (like graphs) and bounded domains, significantly broadening its real-world applicability.

Limitations and Future Work

  • Kernel Selection: As with all kernel methods, SKGT's performance hinges on selecting an appropriate kernel (e.g., tuning the Gaussian kernel width). While the paper relies on standard heuristics, developing an automated method for sequential kernel selection remains an open challenge.
  • Computational Complexity: Calculating KSD at every step for a long-running stream can become computationally expensive, as it requires comparing new data points to all previous ones. For massive datasets where early stopping is not a priority, traditional batch tests might still be more time-efficient.
  • High-Dimensional Scaling: Although KSD handles high dimensions better than many alternatives, the "curse of dimensionality" still impacts the power of non-parametric tests as the number of features increases.

Summary updated

BibTeX
@inproceedings{zhou2024sequential,
  author = {Zhengyu Zhou and Weiwei Liu},
  title = {{Sequential Kernel Goodness-of-fit Testing}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=bmeUeCUMHA},
}
Figure