ddjensen | R Documentation |
Jensen-Shannon divergence between two multivariate (q > 1
) or univariate (q = 1
) discrete probability distributions, estimated from samples.
ddjensen(x1, x2)
x1, x2 |
vectors or data frames of If they are data frames and have not the same column names, there is a warning. |
Let p_1
and p_2
denote the estimated probability distributions of the discrete samples x_1
and x_2
. The Jensen-Shannon divergence between the discrete probability distributions of the samples are computed using the ddjensenpar
function.
The distance between the two probability distributions.
Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Sabine Demotes-Mainard
Deza, M.M. and Deza E. (2013). Encyclopedia of distances. Springer.
ddjensenpar
: Jensen-Shannon distance between two discrete distributions, given the probabilities on their common support.
Other distances: ddchisqsym
, ddhellinger
, ddjeffreys
, ddlp
.
# Example 1
x1 <- c("A", "A", "B", "B")
x2 <- c("A", "A", "A", "B", "B")
ddjensen(x1, x2)
# 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")))
ddjensen(x1, x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.