Dear All,
From time to time I need to resort to the calculation of the earth
mover' distance (see

https://en.wikipedia.org/wiki/Earth_mover's_distance and
https://en.wikipedia.org/wiki/Wasserstein_metric .

In the past I used the package

https://r-forge.r-project.org/projects/earthmovdist/

which apparently is no longer available, but there is plenty of choice
in R.

From the transport package, I found this example

set.seed(27)
x <- pp(matrix(runif(100),50,2))
y <- pp(matrix(runif(100),00,2))
wasserstein(x,y,p=1)

but it is not 100% clear to me how to interpret it.
Are x and y meant as histograms where the the center of each bin is
provided and the total mass in the bins is automatically normalized to
1?

Essentially, my situation is that I have two univariate samples of unequal
size. I would like to bin them and calculate the earth mover's
distance between them.

I am not sure if this is what the example above does.
Cheers

Lorenzo

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to