Abstract
Continuous goodness-of-fit (GOF) is a classical hypothesis testing problem in statistics. Despite numerous suggestions, the Kolmogorov-Smirnov (KS) test is, by far, the most popular GOF test used in practice. Unfortunately, it lacks power at the tails, which is important in many practical applications. In this paper we study the tail-sensitive Calibrated KS (CKS) test statistic, which is intimately related to the works of Berk and Jones and to the Higher Criticism statistic. In contrast to KS, which considers the largest deviation between the empirical and assumed distributions, CKS looks for the deviation which is most statistically significant. We make two main contributions. First, we study some statistical properties of CKS, in particular proving its asymptotic optimality for a wide range of rare-weak mixture models. Second, we derive a novel computationally efficient method to calculate $p$-values for a broad family of one-sided GOF tests, including the one-sided version of CKS, as well as the Higher Criticism and the Berk-Jones tests. We conclude with some simulation results comparing the power of CKS to several other tests.
Introduction
In statistics, a Goodness-of-Fit (GOF) test determines whether a given dataset follows a specific theoretical distribution. For decades, the Kolmogorov-Smirnov (KS) test has served as the industry standard due to its simplicity and computational efficiency. However, the KS test possesses a significant limitation: it is "tail-blind." Because the KS test focuses on the largest absolute deviation between the empirical data and the theoretical model, it typically detects discrepancies near the median of the distribution while ignoring subtle but critical deviations in the extremes (the tails).
This paper revitalizes the Berk-Jones ($M_n$) statistic—also referred to as the Calibrated Kolmogorov-Smirnov (CKS) test—as a powerful alternative. While the Berk-Jones statistic was proposed decades ago, it remained historically overlooked due to computational challenges. The authors provide a theoretical framework for its optimality and a novel algorithm that makes it practical for modern data science.
The Problem with Traditional Tail Sensitivity
Alternative tests like "Higher Criticism" (HC) were developed to address the tail-blindness of the KS test. However, HC often suffers from over-correction; it can become hypersensitive to the very first or last data points, losing power across the rest of the distribution. This occurs because HC uses a "one-size-fits-all" variance normalization that is mathematically inappropriate for extreme tails where distributions are highly skewed.
The CKS/Berk-Jones approach avoids this by using "calibration." Instead of looking for the largest gap, it identifies the most statistically significant deviation. For every data point (order statistic), the test calculates a p-value based on the exact Beta distribution it should follow under the null hypothesis. The test statistic is essentially the minimum of these individual p-values, ensuring sensitivity across the entire distribution without being distracted by outliers.
Computational Breakthrough: $O(n^2)$ Recursive Integration
Historically, calculating exact p-values for supremum-based tests like Berk-Jones was computationally expensive or numerically unstable. Floating-point errors typically caused these calculations to fail once sample sizes reached $n \approx 150$.
The authors overcome this by developing a new $O(n^2)$ recursive integration method. By utilizing a basis of translated polynomials, they achieved numerical stability for datasets as large as $n = 50,000$. This algorithm allows for the efficient calculation of p-values for a broad family of one-sided GOF tests, including Berk-Jones and Higher Criticism, making these robust tools accessible for large-scale data analysis.
Theoretical Contributions and Optimality
The paper provides two primary theoretical insights:
- Adaptive Optimality: The authors prove that the Berk-Jones statistic is adaptively optimal for "rare-weak" mixture models. These are scenarios where a tiny fraction of the data follows a different "contaminant" distribution (e.g., identifying a few active genes among thousands). The test performs nearly as well as a test designed with perfect knowledge of the contamination parameters.
- Consistency: The authors prove that $M_n$ is a consistent test, meaning that as the sample size increases, it will eventually detect any fixed difference between distributions.
Simulation Results
Using synthetic simulations, the authors compared CKS to KS, HC, and the Anderson-Darling (AD) test:
- Rare-Weak Signals: CKS significantly outperformed KS and HC in detecting subtle signals in the tails of Gaussian distributions.
- Variance Changes: In cases where the variance of the data differed from the model (affecting the tails), CKS showed superior power.
- Mean Shifts: The authors noted that the Anderson-Darling test remains slightly superior when the deviation is a simple, uniform shift in the mean of the entire distribution.
Conclusion
The Calibrated Kolmogorov-Smirnov test offers a robust solution to the tail-blindness of the standard KS test. By providing a stable $O(n^2)$ algorithm for exact p-value calculation, the authors have removed the primary barrier to the widespread adoption of Berk-Jones statistics. While slightly more computationally intensive than the $O(n \log n)$ KS test, its superior power in detecting rare-weak signals makes it an essential tool for modern statistical inference.
Summary updated