fasano.franceschini.test: Fasano Franceschini Test

Description Usage Arguments Details Value References Examples

View source: R/fasano_franceschini_test.R

Description

Computes the 2-D Kolmogorov-Smirnov two-sample test as described by Fasano and Franceschini (1987).

Usage

1
fasano.franceschini.test(S1, S2, nBootstrap = 0, nPermute = 0, cores = 1)

Arguments

S1

a [n by 2] data.frame of x and y coordinates of sample 1

S2

a [n by 2] data.frame of x and y coordinates of sample 2

nBootstrap

a depreciated numeric argument defining the number of bootstrapped samples to be generated for computing the empirical p-value. nBootstrap is set to be replaced by nPermute in the next released version of the package.

nPermute

a numeric defining the number of permuted samples to be generated for computing the empirical p-value (note this procedure is slow and computationally expensive on the order of nPermute*O(n^2). Default is set to 0. If nPermute is 0, the Fasano Franceschini distributional approximation is used for defining the p-value. See Fasano and Franceschini test (1987) for details.

cores

a numeric defining the number of cores to use for processing

Details

Code adapted from Press, W. H., Teukolsky, S. A., Vetterling, W. T.,, Flannery, B. P. (2007). Numerical Recipes 3rd Edition: The Art of Scientific Computing. Cambridge University Press. ISBN: 0521880688

Value

the 2-D ks statistic and p-value

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#Underlying distributions are different
#set seed for reproducible example
set.seed(123)

#create 2-D samples with 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(S1 = sample1Data, S2 = sample2Data)


#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(S1 = sample1Data, S2 = sample2Data)

fasano.franceschini.test documentation built on Sept. 5, 2021, 6:02 p.m.