ddchisqsympar function

Distance between discrete probability distributions given the probabilities on their common support

Distance between discrete probability distributions given the probabilities on their common support

Symmetrized chi-squared distance between two discrete probability distributions on the same support (which can be a Cartesian product of qq sets) , given the probabilities of the states (which are qq-tuples) of the support.

ddchisqsympar(p1, p2)

Arguments

  • p1: array (or table) the dimension of which is qq. The first probability distribution on the support.
  • p2: array (or table) the dimension of which is qq. The second probability distribution on the support.

Details

The chi-squared distance between two discrete distributions p1p_1 and p2p_2 is given by:

x(p1(x)p2(x))2/p2(x) \sum_x{(p_1(x) - p_2(x))^2}/p_2(x)

Then the symmetrized chi-squared distance is given by the formula:

p1p2=x(p1(x)p2(x))2/(p1(x)+p2(x)) ||p_1 - p_2|| = \sum_x{(p_1(x) - p_2(x))^2}/(p_1(x) + p_2(x))

Author(s)

Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Sabine Demotes-Mainard

See Also

ddchisqsym: chi-squared distance between two estimated discrete distributions, given samples.

Other distances: ddhellingerpar, ddjeffreyspar, ddjensenpar, ddlppar.

References

Deza, M.M. and Deza E. (2013). Encyclopedia of distances. Springer.

Examples

# Example 1 p1 <- array(c(1/2, 1/2), dimnames = list(c("a", "b"))) p2 <- array(c(1/4, 3/4), dimnames = list(c("a", "b"))) ddchisqsympar(p1, p2) # Example 2 x1 <- 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) ddchisqsympar(p1, p2)
  • Maintainer: Pierre Santagostini
  • License: GPL (>= 2)
  • Last published: 2024-11-22