Skip to contents

Integrated from HelenaLC/simulation-comparison.

Usage

calc_wasserstein_1d(ref, sim, p = 1)

Arguments

ref

Numeric vector of reference values.

sim

Numeric vector of simulated values.

p

Power of the Wasserstein metric (default 1 for standard earth mover's distance).

Value

The 1D Wasserstein distance between the two empirical distributions.

Examples

ref <- stats::rnorm(50)
sim <- stats::rnorm(50)
calc_wasserstein_1d(ref, sim)
#> [1] 0.2052668