wasserstein {approxOT} | R Documentation |
Calculate the Wasserstein distance
Description
Calculate the Wasserstein distance
Usage
wasserstein(
X = NULL,
Y = NULL,
a = NULL,
b = NULL,
cost = NULL,
tplan = NULL,
p = 2,
ground_p = 2,
method = transport_options(),
cost_a = NULL,
cost_b = NULL,
...
)
Arguments
X |
The covariate data of the first sample. |
Y |
The covariate data of the second sample. |
a |
Optional. Empirical measure of the first sample |
b |
Optional. Empirical measure of the second sample |
cost |
Specify the cost matrix in advance. |
tplan |
Give a transportation plan with slots "from", "to", and "mass", like that returned by the [tranportation_plan()] function. |
p |
The power of the Wasserstein distance |
ground_p |
The power of the Lp norm |
method |
Which transportation method to use. See [transport_options()] |
cost_a |
The cost matrix for the first sample with itself. Only used for unbiased Sinkhorn |
cost_b |
The cost matrix for the second sample with itself. Only used for unbiased Sinkhorn |
... |
Additional arguments for various methods:
|
Value
The p-Wasserstein distance, a numeric value
Examples
set.seed(11289374)
n <- 100
z <- stats::rnorm(n)
w <- stats::rnorm(n)
uni <- approxOT::wasserstein(X = z, Y = w,
p = 2, ground_p = 2,
observation.orientation = "colwise",
method = "univariate")