Learn R Programming

LDLcalc (version 2.1)

JSD: Calculate the Jensen-Shannon divergence (JSD)

Description

Calculate the Jensen-Shannon divergence between the same parameter of different data sets. This works only for two distributions.

Usage

JSD(vec1, vec2)

Value

The function returns the value of the Jensen-Shannon divergence (JSD), the frequencies of the two datasets (freq1, freq2, dfFreqs) and the probabilities of the frequencies of the two groups, which should sum up to 1.

Arguments

vec1

The vector containing the values of the first data set.

vec2

The vector containing the values of the second data set.

References

D.M. Endres, J.E. Schindelin, A new metric for probability distributions, IEEE Trans. Inf. Theory (2003), https://doi.org/10.1109/TIT.2003.813506.

F. Oesterreicher, I. Vajda, A new class of metric divergences on probability spaces and its applicability in statistics, Ann. Inst. Stat. Math. (2003), https://doi.org/ 10.1007/BF02517812.

Examples

Run this code
if (FALSE) {
JSDCalc = JSD(model[["trainData"]]$LDLd,model[["testData"]]$LDLd)
}

Run the code above in your browser using DataLab