Wasserstein.diss: Wasserstein distance

View source: R/transport.R

Wasserstein.dissR Documentation

Wasserstein distance

Description

Returns the Wasserstein distance between two samples

Usage

Wasserstein.diss(x, ...)

## Default S3 method:
Wasserstein.diss(x, y, ...)

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

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

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.

Value

a scalar value

Author(s)

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

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

provenance documentation built on May 29, 2024, 4:23 a.m.