squared_wass_approx {waddR}R Documentation

squared_wass_approx

Description

Approximation of the squared wasserstein distance. Calculation based on the mean squared difference between the equidistant empirical quantiles of the two input vectors a and b. As an approximation of the quantile function, 1000 quantiles are computed for each vector.

Usage

squared_wass_approx(x, y)

Arguments

x

Vector representing an empirical distribution under condition A

y

Vector representing an empirical distribution under condition B

Value

The approximated squared wasserstein distance between x and y

References

Schefzik and Goncalves 2019

See Also

[wasserstein_metric()], [squared_wass_decomp()] 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: The squared Wasserstein distance approximated as described in
# Schefzik and Goncalves 2019
d.wass.approx <- squared_wass_approx(x,y)


[Package waddR version 1.2.0 Index]