H | R Documentation |
H(X)
Compute the Shannon's Entropy H(X) = - \sum P(X) * log2(P(X))
based on a
given probability vector P(X)
.
H(x, unit = "log2")
x |
a numeric probability vector |
unit |
a character string specifying the logarithm unit that shall be used to compute distances that depend on log computations. |
This function might be useful to fastly compute Shannon's Entropy for any given probability vector.
a numeric value representing Shannon's Entropy in bit.
Hajk-Georg Drost
Shannon, Claude E. 1948. "A Mathematical Theory of Communication". Bell System Technical Journal 27 (3): 379-423.
JE
, CE
, KL
, JSD
, gJSD
H(1:10/sum(1:10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.