shannon_entropy {msu} | R Documentation |
Estimation of Shannon entropy for a categorical variable.
Description
The Shannon entropy estimates the average minimum number of bits needed to encode a string of symbols, based on the frequency of the symbols (see http://www.bearcave.com/misl/misl_tech/wavelets/compression/shannon.html).
Usage
shannon_entropy(x)
H(x)
Arguments
x |
A factor as the represented categorical variable. |
Value
Shannon entropy estimation of the categorical variable.
Examples
shannon_entropy(factor(c(1,0)))
shannon_entropy(factor(c('a','b','c')))
## Not run:
shannon_entropy(1)
shannon_entropy(c('a','b','c'))
## End(Not run)
[Package msu version 0.0.1 Index]