Ball Divergence: Nonparametric two sample test

Wenliang Pan, Yuan Tian, Xueqin Wang, Heping ZhangThe Annals of Statistics 2018

Abstract

In this paper, we first introduce Ball Divergence, a novel measure of the difference between two probability measures in separable Banach spaces, and show that the Ball Divergence of two probability measures is zero if and only if these two probability measures are identical without any moment assumption. Using Ball Divergence, we present a metric rank test procedure to detect the equality of distribution measures underlying independent samples. It is therefore robust to outliers or heavy-tail data. We show that this multivariate two sample test statistic is consistent with the Ball Divergence, and it converges to a mixture of χ<sup>2</sup> distributions under the null hypothesis and a normal distribution under the alternative hypothesis. Importantly, we prove its consistency against a general alternative hypothesis. Moreover, this result does not depend on the ratio of the two imbalanced sample sizes, ensuring that can be applied to imbalanced data. Numerical studies confirm that our test is superior to several existing tests in terms of Type I error and power. We conclude our paper with two applications of our method: one is for virtual screening in drug development process and the other is for genome wide expression analysis in hormone replacement therapy.

Introduction

The "two-sample test" is a fundamental task in statistical inference: given two sets of data, do they originate from the same underlying population? While classical tools like the Student’s $t$-test or Hotelling’s $T^2$ are highly effective when data follows a normal distribution, real-world datasets often violate these assumptions.

Existing nonparametric alternatives, such as Energy Distance or Maximum Mean Discrepancy (MMD), have addressed some of these limitations but often fall into two specific traps:

  1. The Moment Trap: Many methods require the data to have finite moments (e.g., a finite mean). This makes them fragile when faced with "heavy-tailed" data or extreme outliers where the mean may be undefined or highly volatile.
  2. The Imbalance Trap: Many tests lose significant power or become inconsistent when sample sizes are highly unequal—a common scenario in fields like rare disease research or fraud detection.

This paper introduces Ball Divergence (BD), a measure that bypasses these requirements to provide a robust, "one-size-fits-all" test for multivariate data in complex spaces.

The Ball Divergence Framework

The core innovation of this research is the geometric intuition behind Ball Divergence: two probability measures are identical if and only if they assign the exact same "mass" to every possible ball in a given space.

Mathematically, BD is defined as the squared difference between these masses, integrated over all possible balls. To translate this into a practical statistical tool, the authors developed an empirical BD statistic based on metric ranks. Rather than estimating complex density functions, the test evaluates how many points from one sample fall into a ball centered at a point from the other sample.

Key Technical Advantages

  • Separable Banach Spaces: The theory is not limited to standard Euclidean coordinates; it holds for any space where a distance can be defined, including functional data.
  • Asymptotic Theory: The authors prove that under the null hypothesis (identical distributions), the statistic follows a mixture of $\chi^2$ distributions. Under the alternative hypothesis (different distributions), it follows a normal distribution.
  • Computational Efficiency: While a naive implementation would require $O(n^3)$ operations, the authors provide an optimized algorithm that reduces complexity to $O(n^2 \log n)$ using fast sorting techniques.

Robustness and Consistency

Ball Divergence offers several unique strengths that distinguish it from existing nonparametric methods:

  • Outlier-Proof Geometry: Because BD relies on the probability of points falling into balls rather than the specific values of the points, it is naturally robust. A point located a mile away has the same influence on a ball's count as a point located an inch away, provided both are outside the ball.
  • Moment-Free Analysis: BD is one of the few measures capable of distinguishing distributions even when they have infinite means or variances, such as the Cauchy distribution.
  • Imbalance Independence: The consistency of the BD test does not depend on the ratio of the two sample sizes. This ensures reliability even when comparing a very small treatment group against a large control group.

Empirical Results and Applications

The authors validated BD through extensive simulations and real-world case studies:

Simulation Performance

In tests involving scale shifts (differences in spread rather than just the average), BD significantly outperformed Energy Distance and MMD. It remained consistent even in the presence of extreme heavy tails (e.g., multivariate $t$-distributions with 1 degree of freedom).

Virtual Drug Screening

Using the AID439 and AID1284 datasets, which contain chemical compounds, BD successfully detected distributional differences in highly imbalanced scenarios (e.g., 11 active vs. 45 inactive observations). Other popular tests, such as ESS-NN, proved inconsistent in these settings.

Hormone Replacement Therapy (HRT)

In a gene expression study (GSE3492) involving 22,153 probes across 89 patients, BD identified a significant difference ($p = 0.025$) between treatment groups. In contrast, Energy Distance ($p = 0.477$) and MMD ($p = 0.313$) failed to find any statistically significant signal, demonstrating BD's superior sensitivity in high-dimensional ($p \gg n$) contexts.

Conclusion and Future Directions

Ball Divergence represents a significant advancement in nonparametric statistics, offering a robust solution for complex, imbalanced, and heavy-tailed data. While the current $O(n^2 \log n)$ optimization is efficient, future work may focus on further scaling for "Big Data" applications where distance matrix calculations become a bottleneck. Additionally, while the paper provides a foundation for $K$-sample testing, further exploration into multi-group longitudinal studies remains an open area for research.

Summary updated

BibTeX
@article{pan2018ball,
  author = {Wenliang Pan and Yuan Tian and Xueqin Wang and Heping Zhang},
  title = {{Ball Divergence: Nonparametric two sample test}},
  journal = {The Annals of Statistics},
  year = {2018},
  doi = {10.1214/17-aos1579},
}
Figure