R/avedistTwo.R

Defines functions avedistTwo

Documented in avedistTwo

avedistTwo <-
function(xb1, xb2) {

  distances1 <- apply(xb1, 1, function(y) sqrt(rowSums(sweep(xb2, 2, y, "-")^2)))
  distances2 <- apply(xb2, 1, function(y) sqrt(rowSums(sweep(xb1, 2, y, "-")^2)))

  mean(c(apply(distances1, 2, min), apply(distances2, 2, min)))

}

Try the bapred package in your browser

Any scripts or data that you put into this service are public.

bapred documentation built on June 22, 2022, 9:08 a.m.