Earth movers distance

Share:

Description

Calculates the disimilairty, measured as the earth movers distance.

Usage

1
2
3
4
  ## S4 method for signature 'SpatialPoints,SpatialPoints'
emd(x,y, gc = FALSE, threshold = NULL,...)
  ## S4 method for signature 'RasterLayer,RasterLayer'
emd(x,y, ...)

Arguments

x

A Raster, Raster stack/brick or SpatialPoints object, it is also possible to provide UD objects. In case of spatial points data frame the first columns of data is used as weights. In case of SpatialPoints all points are weighted equally.

y

A Raster or SpatialPoints.

gc

True if great circle distances should be used.

threshold

The maximal distance over which locations are compaired.

...

Currently not used

Value

An dist object is returned

Author(s)

Bart Kranstauber

References

Kranstauber, B., Smolla, M., Safi,K., Similarity in spatial utilization distributions measured by the Earth Mover's Distance.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  data(dbbmmstack)
  values(dbbmmstack)[values(getVolumeUD(dbbmmstack))>.999999]<-0
  stk<-(dbbmmstack/cellStats(dbbmmstack,sum))
  emd(stk[[1]],stk[[2]])
  emd(stk)
  emd(stk, threshold=10000)
  x<-SpatialPointsDataFrame(cbind(c(1:3,5),2), data=data.frame(rep(.25,4)))
  y<-SpatialPointsDataFrame(coordinates(x), data.frame(c(0,.5,.5,0)))
  emd(x,y)
  emd(x,y,threshold=.1)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.