Fasano-Franceschini Test

R build status Lifecycle: maturing

The fasano.franceschini.test package is an R implementation of the 2-D Kolmogorov-Smirnov (KS) two-sample test as defined by Fasano and Franceschini (1987). This is a variant of the 2-D two-sample KS test as originally defined by Peacock (1983).

Installation

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

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

And the development version of the fasano.franceschini.test package from GitHub with:

# install.packages("devtools")
devtools::install_github("nesscoder/fasano.franceschini.test")

Example

Underlying Distributions Are Different

library(fasano.franceschini.test)

#set seed for reproducible example
set.seed(123)

#create 2-D samples with the different underlying distributions
sample1Data <- data.frame(
  x = rnorm(n = 50, mean = 0, sd = 3),
  y = rnorm(n = 50, mean = 0, sd = 1)
)
sample2Data <- data.frame(
  x = rnorm(n = 50, mean = 0, sd = 1),
  y = rnorm(n = 50, mean = 0, sd = 3)
)

fasano.franceschini.test(sample1Data,sample2Data)
#> 
#>  Fasano-Francheschini Test
#> 
#> data:  sample1Data and sample2Data
#> D-stat = 0.33, p-value = 0.02221
#> sample estimates:
#> dff,1 dff,2 
#> 0.325 0.335

Underlying Distributions Are The Same

#set seed for reproducible example
set.seed(123)

#create 2-D samples with the same underlying distributions
sample1Data <- data.frame(
  x = rnorm(n = 50, mean = 0, sd = 1),
  y = rnorm(n = 50, mean = 0, sd = 1)
)
sample2Data <- data.frame(
  x = rnorm(n = 50, mean = 0, sd = 1),
  y = rnorm(n = 50, mean = 0, sd = 1)
)

fasano.franceschini.test(sample1Data,sample2Data)
#> 
#>  Fasano-Francheschini Test
#> 
#> data:  sample1Data and sample2Data
#> D-stat = 0.19, p-value = 0.4448
#> sample estimates:
#> dff,1 dff,2 
#> 0.205 0.175