Abstract
Permutation tests are a popular choice for distinguishing distributions and testing independence, due to their exact, finite-sample control of false positives and their minimax optimality when paired with U-statistics. However, standard permutation tests are also expensive, requiring a test statistic to be computed hundreds or thousands of times to detect a separation between distributions. In this work, we offer a simple approach to accelerate testing: group your datapoints into bins and permute only those bins. For U and V-statistics, we prove that these cheap permutation tests have two remarkable properties. First, by storing appropriate sufficient statistics, a cheap test can be run in time comparable to evaluating a single test statistic. Second, cheap permutation power closely approximates standard permutation power. As a result, cheap tests inherit the exact false positive control and minimax optimality of standard permutation tests while running in a fraction of the time. We complement these findings with improved power guarantees for standard permutation testing and experiments demonstrating the benefits of cheap permutations over standard maximum mean discrepancy (MMD), Hilbert-Schmidt independence criterion (HSIC), random Fourier feature, Wilcoxon-Mann-Whitney, cross-MMD, and cross-HSIC tests.
Introduction
Permutation tests are often considered the "gold standard" for statistical hypothesis testing. Whether evaluating if two datasets originate from the same distribution (homogeneity testing) or if two variables are dependent (independence testing), these tests provide exact, finite-sample control of false positives. Unlike asymptotic tests, which rely on large-sample approximations that may fail for small or complex datasets, permutation tests remain valid regardless of the sample size.
However, this reliability comes with a significant computational burden. Standard permutation tests require recomputing a test statistic hundreds or thousands of times to build a null distribution. For modern quadratic statistics like Maximum Mean Discrepancy (MMD) or the Hilbert-Schmidt Independence Criterion (HSIC), which have $O(n^2)$ complexity for $n$ data points, the total cost $O(B \cdot n^2)$ for $B$ permutations becomes a bottleneck for large datasets.
The Cheap Permutation Method
In "Cheap Permutation Testing," the authors introduce a simple yet powerful modification: binned permutations. Instead of shuffling individual data points, the method groups $n$ data points into $s$ equal-sized bins and permutes the bin labels.
The efficiency of this approach stems from the use of sufficient statistics. For U and V-statistics, the authors demonstrate that one can precompute the interactions between bins. Once these bin-level interactions are stored, the cost of each subsequent permutation depends only on the number of bins $s$, rather than the total number of points $n$.
As illustrated in the complexity table above, the permutation time for cheap tests is $O(B \cdot s^2)$. When $s$ is chosen to be much smaller than $n$, the time spent on permutations becomes negligible compared to the initial calculation of the test statistic.
Theoretical and Empirical Performance
A critical question is whether reducing the number of permutations (by binning) sacrifices statistical power. The authors prove that cheap permutation tests maintain the same minimax optimal detection rates as standard tests. For independence testing, they show that even a constant number of bins $s$ can be sufficient to match the power of a full permutation test.
Empirical results support these theoretical findings:
- Speed: In experiments involving MMD and HSIC, cheap tests achieved speedups ranging from 100x to 900x compared to standard permutation methods.
- Power Preservation: For a dataset with $n \approx 16,000$, using only $s=128$ bins was sufficient to perfectly match the statistical power of the full $O(n^2)$ permutation test.
- Robustness: The cheap permutation test consistently outperformed "asymptotic cross-MMD" tests, providing higher power and guaranteed validity while maintaining comparable speeds.
Conclusion
Cheap permutation testing offers a scalable solution for exact statistical inference. By leveraging binning and sufficient statistics, researchers can enjoy the finite-sample guarantees of permutation tests at a fraction of the traditional computational cost. This approach is particularly valuable for large-scale machine learning applications where quadratic statistics are standard. The authors have made their implementation available on GitHub to facilitate adoption in the broader scientific community.
Summary updated