[Paper Review] fasano.franceschini.test: An Implementation of a Multidimensional KS Test in R
This paper presents the fasano.franceschini.test R package, implementing the Fasano–Franceschini multidimensional two-sample Kolmogorov–Smirnov test, which efficiently compares multivariate distributions of any dimension and data type (continuous, discrete, or mixed). The method reduces computational complexity by maximizing test statistics only over sample points rather than all coordinate combinations, achieving competitive power—especially on copula-based alternatives—while remaining computationally feasible for high-dimensional data.
The Kolmogorov-Smirnov (KS) test is a nonparametric statistical test used to test for differences between univariate probability distributions. The versatility of the KS test has made it a cornerstone of statistical analysis across many scientific disciplines. However, the test proposed by Kolmogorov and Smirnov does not easily extend to multidimensional distributions. Here we present the fasano.franceschini.test package, an R implementation of a multidimensional two-sample KS test described by Fasano and Franceschini (1987). The fasano.franceschini.test package provides a test that is computationally efficient, applicable to data of any dimension and type (continuous, discrete, or mixed), and that performs competitively with similar R packages.
Motivation & Objective
- To address the lack of a computationally efficient, general-purpose multivariate two-sample KS test applicable to arbitrary data types and dimensions.
- To implement the Fasano–Franceschini test in R, overcoming limitations of existing multivariate KS extensions that are either computationally intractable or restricted to specific data types or dimensions.
- To provide a user-friendly, performant R package with exact p-value computation and robust handling of mixed and high-dimensional data.
- To benchmark the proposed test against existing multivariate goodness-of-fit tests (Cramér, DiProPerm) in terms of power and computational efficiency across diverse distributional alternatives.
Proposed method
- The test computes a multidimensional KS statistic by evaluating the maximum absolute difference in empirical cumulative distribution functions across all $2^d$ orthants defined by each point in the sample.
- For each point $\mathbf{p}$, the method calculates the proportion of points from each sample falling in each orthant $\mathcal{O}_j(\mathbf{p})$, defined by the sign of differences in coordinates.
- The test statistic $D(\mathbf{p})$ is the maximum over all orthants of the absolute difference in these proportions between the two samples.
- The p-value is computed via Monte Carlo permutation testing, where the two samples are pooled and repeatedly re-assigned to estimate the null distribution of the test statistic.
- The algorithm reduces computational cost from cubic to linear in sample size by restricting maximization to sample points rather than all coordinate-wise combinations.
- The implementation supports continuous, discrete, and mixed data types by using indicator functions to compute orthant membership probabilities.
Experimental results
Research questions
- RQ1How does the Fasano–Franceschini test perform in comparison to other multivariate two-sample tests (Cramér, DiProPerm) in terms of statistical power across different types of distributional alternatives?
- RQ2Can the Fasano–Franceschini test maintain high power in high-dimensional settings, particularly when the marginal distributions are identical but dependence structures differ?
- RQ3How does the computational complexity of the Fasano–Franceschini test scale with increasing sample size and dimensionality, and is it feasible for large-scale data?
- RQ4Does the test outperform existing methods on alternatives involving copula structures, where marginal distributions are identical but dependence is different?
- RQ5To what extent does the test’s performance degrade in high dimensions, especially under location and dispersion alternatives?
Key findings
- On copula-based alternatives (Gaussian and Clayton), the Fasano–Franceschini test consistently outperformed both the Cramér and DiProPerm tests, achieving near-one power by dimension $d=10$.
- On location alternatives, the Fasano–Franceschini test’s power peaked at $d=5$ and then declined to $\alpha=0.05$ by $d=20$, while the Cramér and DiProPerm tests maintained or increased power with dimension.
- On dispersion alternatives, the Fasano–Franceschini and Cramér tests showed comparable power at low dimensions, but the Cramér test maintained higher power at high dimensions.
- The DiProPerm test failed to achieve power above $\alpha=0.05$ on dispersion and copula alternatives due to high overlap in high-density regions, making separation via linear hyperplanes difficult.
- The Fasano–Franceschini test demonstrated competitive performance with exact p-value computation and efficient scaling, making it suitable for high-dimensional data with mixed or discrete data types.
- The package implementation is computationally efficient and supports any data type and dimension, with full documentation and source code available on CRAN and the project website.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.