Learn R Programming

provenance (version 4.4)

Wasserstein.diss: Wasserstein distance

Description

Returns the Wasserstein distance between two samples

Usage

Wasserstein.diss(x, ...)

# S3 method for default Wasserstein.diss(x, y, ...)

# S3 method for distributional Wasserstein.diss(x, log = FALSE, ...)

# S3 method for varietal Wasserstein.diss(x, package = "transport", verbose = FALSE, ...)

Value

a scalar value

Arguments

x

the first sample as a vector

...

optional arguments to the transport::wasserstein() or T4transport::wasserstein() functions. Warning: the latter function is very slow.

y

the second sample as a vector

log

logical. Take the lograthm of the data before calculating the distances?

package

the name of the package that provides the 2D Wasserstein distance. Currently, this can be either 'transport' or T4transport.

verbose

logical. If TRUE, gives progress updates during the construction of the dissimilarity matrix.

Author

The default S3 method was written by Pieter Vermeesch, using modified code from Dominic Schuhmacher's transport package (transport1d function), as implemented in IsoplotR.

Examples

Run this code
data(Namib)
print(Wasserstein.diss(Namib$DZ$x[['N1']],Namib$DZ$x[['T8']]))

Run the code above in your browser using DataLab