Divergence matrix of compositional data | R Documentation |
Divergence matrix of compositional data.
divergence(x, type = "kullback_leibler", vector = FALSE)
x |
A matrix with the compositional data. |
type |
This is either "kullback_leibler" (Kullback-Leibler, which computes the symmetric Kullback-Leibler divergence) or "jensen_shannon" (Jensen-Shannon) divergence. |
vector |
For return a vector instead a matrix. |
The function produces the distance matrix either using the Kullback-Leibler (distance) or the Jensen-Shannon (metric) divergence. The Kullback-Leibler refers to the symmetric Kullback-Leibler divergence.
if the vector argument is FALSE a symmetric matrix with the divergences, otherwise a vector with the divergences.
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
Endres, D. M. and Schindelin, J. E. (2003). A new metric for probability distributions. Information Theory, IEEE Transactions on 49, 1858-1860.
Osterreicher, F. and Vajda, I. (2003). A new class of metric divergences on probability spaces and its applicability in statistics. Annals of the Institute of Statistical Mathematics 55, 639-653.
comp.knn, js.compreg
x <- as.matrix(iris[1:20, 1:4])
x <- x / rowSums(x)
divergence(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.