wass_stat {twosamples}R Documentation

Wasserstein Distance Test A two-sample test based on Wasserstein's distance.

Description

Wasserstein Distance Test A two-sample test based on Wasserstein's distance.

Usage

wass_stat(a, b, power = 1)

wass_test(a, b, nboots = 2000, p = default.p)

Arguments

a

a vector of numbers

b

a vector of numbers

power

power to raise test stat to

nboots

Number of bootstrap iterations

p

power to raise test stat to

Details

The Wasserstein test compares two ECDFs by looking at the Wasserstein distance between the two. This is of course the area between the two ECDFs. Formally – if E is the ECDF of sample 1 and F is the ECDF of sample 2, then WASS = Integral |E(x)-F(x)| across all x. The test p-value is calculated by randomly resampling two samples of the same size using the combined sample. Intuitively the Wasserstein test improves on CVM by allowing more extreme observations to carry more weight. At a higher level – CVM/AD/KS/etc only require ordinal data. Wasserstein gains its power because it takes advantages of the properties of interval data – i.e. the distances have some meaning.

Value

Output is a length 2 Vector with test stat and p-value in that order. That vector has 3 attributes – the sample sizes of each sample, and the number of bootstraps performed for the pvalue.

Functions

Examples

vec1 = rnorm(20)
vec2 = rnorm(20,4)
wass_test(vec1,vec2)

[Package twosamples version 1.0.0 Index]