EMD: Calculates the EMD for two vectors 'x' and 'y'.

View source: R/EMD.R

EMDR Documentation

Calculates the EMD for two vectors x and y.

Description

Calculates the EMD for two vectors x and y.

Usage

EMD(
  x,
  y,
  weight.m = matrix(rep(1, length(x)^2), ncol = length(x), byrow = TRUE) - diag(1,
    length(x), length(x))
)

Arguments

x, y

The two vectors to compare

weight.m

Matrix of weights. Values should be 'numeric'.

Value

The EMD between x and y.

Examples

EMD(1:5/sum(1:5), 6:10/sum(6:10))
EMD(1:5, 6:10) # The vectors are normalised by the function
m <- matrix(1:25, ncol=5)
diag(m) <- 0
EMD(1:5, 6:10, weight.m=m)


mchevalier2/paleotools documentation built on Jan. 7, 2025, 3:37 a.m.