wasserstein_permut.Rd
Permutation test based on Wasserstein distance
wasserstein_permut( x, y, iterations = 10^4, fast = nrow(x) + nrow(y) > 10^3, S = NULL, ... )
x | Samples from the first distribution |
---|---|
y | Samples from the second distribution. Only used if x is a vector. |
iterations | How many iterations to do to simulate the null distribution. Default to 10^4. |
fast | If true, uses the subwasserstein approximate function. Default to true if there are more than 1,000 samples total. |
S | Number of samples to use in approximate mode. Must be set if |
... | Other parameters passed to wasserstein or wasserstein1d |
A list containing the following components:
statistic the Wasserstein distance between x and y.
p.value the p-value of the permutation test.
x <- matrix(c(runif(100, 0, 1), runif(100, -1, 1)), ncol = 2) y <- matrix(c(runif(100, 0, 3), runif(100, -1, 1)), ncol = 2) # Set iterations to small number for runtime # Increase for more accurate results wasserstein_permut(x, y, iterations = 10^2)#> $statistic #> [1] 0.9740584 #> #> $p.value #> [1] 0.01 #>