| kantorovich | R Documentation |
Compute the Kantorovich distance between two probability measures on a finite set.
kantorovich(mu, nu, dist = NULL, details = FALSE, ...)
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 |
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.
The Kantorovich distance between mu and nu.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.