Package 'otinference'

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

Help Index


Two-sample test for multivariate data based on binning.

Description

Two-sample test for multivariate data based on binning.

Usage

binWDTest(x, y, L = 5, B = 100)

Arguments

x, y

The two samples, rows are realizations.

L

Number of bins in each dimension.

B

Number of realizations of limiting distribution to simulate.

Value

p-value.

Examples

## 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.

Description

Sample from the limit distribution under the alternative.

Usage

limDisAlt(B = 1000, r, s, distMat, p = 1)

Arguments

B

Number of samples to generate.

r, s

Number of counts giving the two samples.

distMat

Distance matrix.

p

Cost exponent. Defaults to 1.

Value

A vector of samples.


m-out-of-n Bootstrap for the limiting distribution.

Description

m-out-of-n Bootstrap for the limiting distribution.

Usage

limDisAltBoot(r, s, distMat, B = 1000, p = 1, gamma = 0.9)

Arguments

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.

Value

A sample from the limiting distribution.


Sample from the limiting distribution under the null.

Description

Sample from the limiting distribution under the null.

Usage

limDisNull(B = 500, r, distMat, p = 1)

Arguments

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.

Value

A vector of samples.


Sample from the limiting distribution under the null when the underlying space is a grid.

Description

Sample from the limiting distribution under the null when the underlying space is a grid.

Usage

limDisNullGrid(B = 500, r, p = 1)

Arguments

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.

Value

A vector of samples.


Compute the Wasserstein distance between to finite distributions.

Description

Compute the Wasserstein distance between to finite distributions.

Usage

wassDist(a, b, distMat, p = 1)

Arguments

a, b

Vectors representing probability distributions.

distMat

Cost matrix.

p

cost exponent.

Value

The Wasserstein distance.