# Nonparametric Two-Sample Testing by Betting

Source: [Nonparametric Two-Sample Testing by Betting](<https://www.sota2.com/research/paper/68fa5e131e209131ce9df11b>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2025-10-25T18:34:58.085Z

Authors: Shubhanshu Shekhar, Aaditya Ramdas

Published: 2021-12-16T19:17:40.000Z

## Abstract

We study the problem of designing consistent sequential two-sample tests in a nonparametric setting. Guided by the principle of testing by betting, we reframe this task into that of selecting a sequence of payoff functions that maximize the wealth of a fictitious bettor, betting against the null in a repeated game. In this setting, the relative increase in the bettor's wealth has a precise interpretation as the measure of evidence against the null, and thus our sequential test rejects the null when the wealth crosses an appropriate threshold. We develop a general framework for setting up the betting game for two-sample testing, in which the payoffs are selected by a prediction strategy as data-driven predictable estimates of the witness function associated with the variational representation of some statistical distance measures, such as integral probability metrics (IPMs). We then formally relate the statistical properties of the test~(such as consistency, type-II error exponent and expected sample size) to the regret of the corresponding prediction strategy. We construct a practical sequential two-sample test by instantiating our general strategy with the kernel-MMD metric, and demonstrate its ability to adapt to the difficulty of the unknown alternative through theoretical and empirical results. Our framework is versatile, and easily extends to other problems; we illustrate this by applying our approach to construct consistent tests for the following problems: (i) time-varying two-sample testing with non-exchangeable observations, and (ii) an abstract class of "invariant" testing problems, including symmetry and independence testing.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Sequential Distribution Shift Detection on ImageNet-C, ImageNet-R, and Office-Home streams](<https://www.sota2.com/research/sota/sequential-distribution-shift-detection-on-imagenet-c-imagenet-r-and-office-home-streams.md>): Sequential Distribution Shift Detection; ImageNet-C, ImageNet-R, and Office-Home sequential streams; Detection Delay (samples): 20.3.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2112.09162>)

[PDF](<https://arxiv.org/pdf/2112.09162.pdf>)
