Kullback-Leibler Divergence (Cross-entropy)

divergence(x, y, type = c("Kullback-Leibler", "cross-entropy"))

Arguments

x

a vector of integer values, defining observed

y

a vector of integer values, defining estimates

type

Type of divergence statistic c("Kullback-Leibler", "cross-entropy")

Value

single value vector with divergence statistic

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

x <- round(runif(10,1,4),0) y <- round(runif(10,1,4),0) divergence(x, y)
#> Kullback-Leibler
#> [1] 0.1673976
divergence(x, y, type = "cross-entropy")
#> Cross-Entropy
#> [1] 4.115996