Fasano-Franceschini Test: A Multivariate Kolmogorov-Smirnov Two-Sample Test

An implementation of the two-sample multivariate Kolmogorov-Smirnov test described by Fasano and Franceschini (1987) . This test evaluates the null hypothesis that two i.i.d. random samples were drawn from the same underlying probability distribution. The data can be of any dimension, and can be of any type (continuous, discrete, or mixed).


Fasano-Franceschini Test

R buildstatus

The fasano.franceschini.test package is an R implementation of the multivariate Kolmogorov-Smirnov two-sample test as defined by Fasano and Franceschini (1987).

Fasano, G. & Franceschini, A. (1987). A multidimensional version of the
Kolmogorov-Smirnov test. Monthly Notices of the Royal Astronomical Society,
225:155-170. doi: 10.1093/mnras/225.1.155.

A manuscript accompanying this package was published in The R Journal.

Puritz, C., Ness-Cohn, E., Braun, R. (2023). fasano.franceschini.test: An Implementation
of a Multivariate KS Test in R. The R Journal, 15(3):159-171. doi: 10.32614/RJ-2023-067.

Installation

You can install the released version of the fasano.franceschini.test package from CRAN with:

install.packages("fasano.franceschini.test")

The development version of the fasano.franceschini.test package can be installed from GitHub with:

if (!require("devtools", quietly = TRUE))
    install.packages("devtools")
devtools::install_github("braunlab-nu/fasano.franceschini.test")

Examples

Underlying distributions are the same

library(fasano.franceschini.test)

# set seed for reproducibility
set.seed(0)

# create 2D samples from the same underlying distribution
S1 <- data.frame(x = rnorm(n = 50, mean = 0, sd = 1),
                 y = rnorm(n = 50, mean = 0, sd = 3))
S2 <- data.frame(x = rnorm(n = 100, mean = 0, sd = 1),
                 y = rnorm(n = 100, mean = 0, sd = 3))

fasano.franceschini.test(S1, S2, seed = 0)
#> 
#>  Fasano-Franceschini Test
#> 
#> data:  S1 and S2
#> D = 1700, p-value = 0.6333

Underlying distributions are different

# set seed for reproducibility
set.seed(1)

# create 3D samples from different underlying distributions
S1 <- cbind(rgamma(n = 43, shape = 2),
            rpois(n = 43, lambda = 5),
            rpois(n = 43, lambda = 3.5))
S2 <- cbind(rgamma(n = 72, shape = 2),
            rpois(n = 72, lambda = 5),
            rpois(n = 72, lambda = 5))

fasano.franceschini.test(S1, S2, seed = 1)
#> 
#>  Fasano-Franceschini Test
#> 
#> data:  S1 and S2
#> D = 2022, p-value = 0.01977

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("fasano.franceschini.test")

2.2.2 by Connor Puritz, 3 years ago


https://github.com/braunlab-nu/fasano.franceschini.test


Report a bug at https://github.com/braunlab-nu/fasano.franceschini.test/issues


Browse source code at https://github.com/cran/fasano.franceschini.test


Authors: Connor Puritz [aut, cre] , Elan Ness-Cohn [aut] , Rosemary Braun [ctb, ths] , Luca Weihs [cph] (Copyright holder and author of 'RangeTree' class.)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp, RcppParallel

Suggests testthat

Linking to Rcpp, RcppParallel

System requirements: GNU make


See at CRAN