kantorovich {kantorovich} | R Documentation |
Kantorovich distance
Description
Compute the Kantorovich distance between two probability measures on a finite set.
Usage
kantorovich(mu, nu, dist = NULL, details = FALSE, ...)
Arguments
mu |
(row margins) probability measure in numeric or bigq/character mode |
nu |
(column margins) probability measure in numeric or bigq/character mode |
dist |
function or matrix, the distance to be minimized on average;
if |
details |
prints the joinings achieving the Kantorovich distance and
returns them in the |
... |
arguments passed to |
Details
The function firstly computes all the extreme joinings of mu
and nu
, then evaluates the average distance for each of them, and
then returns the minimal one.
Value
The Kantorovich distance between mu
and nu
.
Examples
mu <- c(1/7, 2/7, 4/7)
nu <- c(1/4, 1/4, 1/2)
kantorovich(mu, nu)
library(gmp)
mu <- as.bigq(c(1,2,4), 7)
nu <- as.bigq(c(1,1,1), c(4,4,2))
kantorovich(mu, nu)
mu <- c("1/7", "2/7", "4/7")
nu <- c("1/4", "1/4", "1/2")
kantorovich(mu, nu, details=TRUE)
[Package kantorovich version 3.2.0 Index]