Skip to contents

In one dimension the optimal coupling is always monotone: sort both samples and match in order. No linear program is needed, which is why this case is the building block for sliced Wasserstein.

Usage

Otws(x, y)

Arguments

x, y

Samples of equal length.

Value

List with W1, estimate, n.

Details

Formula: W_1 = int |F(t) - G(t)| dt, equal to mean |x_(i) - y_(i)| for equal sample sizes.

References

Vallender, S. S. (1973). Theory Probab Appl 18:784-786.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Otws(V, V)
#> $W1
#> [1] 0
#> 
#> $estimate
#> [1] 0
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "One-dimensional Wasserstein-1 distance"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"