Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

divergence

Divergence matrix of compositional data


Description

Divergence matrix of compositional data.

Usage

divergence(x, type = "kullback_leibler", vector = FALSE)

Arguments

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.

Details

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.

Value

if the vector argument is FALSE a symmetric matrix with the divergences, otherwise a vector with the divergences.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr

References

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.

See Also

Examples

x <- as.matrix(iris[1:20, 1:4])
x <- x / rowSums(x)
divergence(x)

Compositional

Compositional Data Analysis

v4.6
GPL (>= 2)
Authors
Michail Tsagris [aut, cre], Giorgos Athineou [aut], Abdulaziz Alenazi [ctb]
Initial release
2021-04-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.