squared_wass_decomp {waddR}R Documentation

squared_wass_decomp

Description

Approximation of the squared Wasserstein distance W_g between two vectors decomposed into size, location and shape. Calculation based on the mean squared difference between the equidistant quantiles of the two input vectors a and b. As an approximation of the distribution, 1000 quantiles are computed for each vector.

Usage

squared_wass_decomp(x, y)

Arguments

x

Vector representing an empirical distribution under condition A

y

Vector representing an empirical distribution under condition B

Value

An named Rcpp::List with the wasserstein distance between x and y, decomposed into terms for size, location, and shape

References

Schefzik and Goncalves 2019 Irpino and Verde (2015)

See Also

[wasserstein_metric()], [squared_wass_approx()] for different implementations of the wasserstein distance

Examples

# input: one dimensional data in two conditions
x <- rnorm(100, 42, 2)
y <- c(rnorm(61, 20, 1), rnorm(41, 40,2))
# output: squared Wasserstein distance decomposed into terms for location,
# shape, size
d.wass.decomp <- squared_wass_decomp(x,y)
d.wass.decomp$location
d.wass.decomp$size
d.wass.decomp$shape


[Package waddR version 1.2.0 Index]