wasserstein.test: wasserstein.test

Description Usage Arguments Details Value References Examples

View source: R/WassersteinTest.R

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

1
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=<e2><80><9d>SP<e2><80><9d> 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

1
2
3
4
5
6
7
8
9
# 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")

waddR documentation built on Nov. 8, 2020, 8:32 p.m.