A composition carries only relative information, so it is closed to
the simplex before the divergence is taken – which is exactly what
Jsdiv(normalize = TRUE) does, and why the arithmetic is not
duplicated here. Closure makes the answer invariant to the total.
This is an information divergence on the closed parts, not an
Aitchison distance: it is not subcompositionally invariant and uses
no log-ratios. A zero part contributes zero, where a log-ratio
geometry would be undefined – a reason to prefer it on sparse
compositions and a reason not to call it Aitchison.
References
Lin (1991), IEEE Transactions on Information Theory 37:145-151; coded form from philentropy. See Jsdiv for the full note.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Compjsd(V, V)
#> $estimate
#> [1] 0
#>
#> $distance
#> [1] 0
#>
#> $bound
#> [1] 1
#>
#> $base
#> [1] 2
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Jensen-Shannon divergence"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
