Title: | Inference for Optimal Transport |
---|---|
Description: | Sample from the limiting distributions of empirical Wasserstein distances under the null hypothesis and under the alternative. Perform a two-sample test on multivariate data using these limiting distributions and binning. |
Authors: | Max Sommerfeld [aut, cre] |
Maintainer: | Max Sommerfeld <[email protected]> |
License: | GPL-2 |
Version: | 0.1.0 |
Built: | 2024-12-22 06:35:54 UTC |
Source: | CRAN |
Two-sample test for multivariate data based on binning.
binWDTest(x, y, L = 5, B = 100)
binWDTest(x, y, L = 5, B = 100)
x , y
|
The two samples, rows are realizations. |
L |
Number of bins in each dimension. |
B |
Number of realizations of limiting distribution to simulate. |
p-value.
## Not run: x <- MASS::mvrnorm(n = 100, mean = c(0, 0), Sigma = diag(1, 2)) y <- MASS::mvrnorm(n = 100, mean = c(0, 0), Sigma = diag(2, 2)) pVal <- binWDTest(x, y) ## End(Not run)
## Not run: x <- MASS::mvrnorm(n = 100, mean = c(0, 0), Sigma = diag(1, 2)) y <- MASS::mvrnorm(n = 100, mean = c(0, 0), Sigma = diag(2, 2)) pVal <- binWDTest(x, y) ## End(Not run)
Sample from the limit distribution under the alternative.
limDisAlt(B = 1000, r, s, distMat, p = 1)
limDisAlt(B = 1000, r, s, distMat, p = 1)
B |
Number of samples to generate. |
r , s
|
Number of counts giving the two samples. |
distMat |
Distance matrix. |
p |
Cost exponent. Defaults to 1. |
A vector of samples.
m-out-of-n Bootstrap for the limiting distribution.
limDisAltBoot(r, s, distMat, B = 1000, p = 1, gamma = 0.9)
limDisAltBoot(r, s, distMat, B = 1000, p = 1, gamma = 0.9)
r , s
|
Vectors of counts giving the two samples. |
distMat |
Distance matrix. |
B |
The number of samples to generate. Defaults to 1000. |
p |
Cost exponent. Defaults to 1. |
gamma |
m = n^gamma. Defaults to 0.9. |
A sample from the limiting distribution.
Sample from the limiting distribution under the null.
limDisNull(B = 500, r, distMat, p = 1)
limDisNull(B = 500, r, distMat, p = 1)
B |
number of samples to generate. Defaults to 500. |
r |
vector of probabilities in the original problem. |
distMat |
distance matrix in the original problem. |
p |
cost exponent. Defaults to 1. |
A vector of samples.
Sample from the limiting distribution under the null when the underlying space is a grid.
limDisNullGrid(B = 500, r, p = 1)
limDisNullGrid(B = 500, r, p = 1)
B |
Number of bootstrap samples to generate. Defaults to 500. |
r |
vector of probabilities in the original problem. Is interpreted as a square matrix. |
p |
cost exponent. |
A vector of samples.
Compute the Wasserstein distance between to finite distributions.
wassDist(a, b, distMat, p = 1)
wassDist(a, b, distMat, p = 1)
a , b
|
Vectors representing probability distributions. |
distMat |
Cost matrix. |
p |
cost exponent. |
The Wasserstein distance.