wasserstein.test {waddR}R Documentation

wasserstein.test

Description

Two-sample test to check for differences between two distributions (conditions) using the 2-Wasserstein distance, either using the semi-parametric permutation testing procedure with GPD approximation to estimate small p-values accurately or the test based on asymptotic theory

Usage

wasserstein.test(x, y, method = c("SP", "ASY"), permnum = 10000)

Arguments

x

univariate sample (vector) representing the distribution of condition A

y

univariate sample (vector) representing the distribution of condition B

method

testing procedure to be employed: "SP" for the semi-parametric permutation testing procedure with GPD approximation to estimate small p-values accurately; "ASY" for the test based on asymptotic theory. If no method is given, "SP" will be used by default.

permnum

number of permutations used in the permutation testing procedure (if method=”SP” is performed); default is 10000

Details

Details concerning the two testing procedures (i.e. the permutation testing procedure with GPD approximation to estimate small p-values accurately and the test based on asymptotic theory) can be found in Schefzik and Goncalves (2019).

Value

A vector concerning the testing results (see Schefzik and Goncalves (2019) for details).

A vector concerning the testing results, precisely (see Schefzik and Goncalves (2019) for details)

References

Schefzik, R. and Goncalves, A. (2019).

Examples

# generate two input distributions
x<-rnorm(500)
y<-rnorm(500,4,1.5)
wasserstein.test(x,y,method="ASY")
# Run with default options: method="SP", permnum=10000
wasserstein.test(x,y)
# Run with a seed for the semi-parametric test ("SP")
set.seed(42)
wasserstein.test(x,y, method="SP")


[Package waddR version 1.2.0 Index]