Distance between discrete probability distributions given the probabilities on their common support
Distance between discrete probability distributions given the probabilities on their common support
Lp distance between two discrete probability distributions on the same support (which can be a Cartesian product of q sets) , given the probabilities of the states (which are q-tuples) of the support.
ddlppar(p1, p2, p =1)
Arguments
p1: array (or table) the dimension of which is q. The first probability distribution on the support.
p2: array (or table) the dimension of which is q. The second probability distribution on the support.
p: integer. Parameter of the distance.
Details
The Lp distance ∣∣p1−p2∣∣ between two discrete distributions p1 and p2 is given by the formula:
∣∣p1−p2∣∣p=x∑∣p1(x)−p2(x)∣p
If p=1, it is the variational distance.
If p=2, it is the Patrick-Fisher distance.
Author(s)
Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Sabine Demotes-Mainard
See Also
ddlp: Lp distance between two estimated discrete distributions, given samples.
Other distances: ddchisqsympar, ddhellingerpar, ddjeffreyspar, ddjensenpar.
References
Deza, M.M. and Deza E. (2013). Encyclopedia of distances. Springer.
Examples
# Example 1p1 <- array(c(1/2,1/2), dimnames = list(c("a","b")))p2 <- array(c(1/4,3/4), dimnames = list(c("a","b")))ddlppar(p1, p2)ddlppar(p1, p2, p=2)# Example 2x1 <- data.frame(x = factor(c("A","A","A","B","B","B")), y = factor(c("a","a","a","b","b","b")))x2 <- data.frame(x = factor(c("A","A","A","B","B")), y = factor(c("a","a","b","a","b")))p1 <- table(x1)/nrow(x1)p2 <- table(x2)/nrow(x2)ddlppar(p1, p2)