SciencesPo (version 1.3.8)

jensen.shannon: Jensen-Shannon Distance

Description

The Jensen-Shannon divergence or distance matrix stores the $n*(n-1)/2$ pairwise distances/similarities between observations in an $n x p$ matrix where n correspond to the independent observational units and p represent the covariates measured on each individual.

Usage

jensen.shannon(mat)

Arguments

mat
An n x p matrix.

encoding

UTF-8

Examples

Run this code
# create a matrix
n  = 10
m = matrix(runif(n*10), ncol = 10)
m = m/rowSums(m)
jensen.shannon(m)

Run the code above in your browser using DataLab