powered by
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).
shannon_entropy(x)H(x)
H(x)
A factor as the represented categorical variable.
Shannon entropy estimation of the categorical variable.
# NOT RUN { shannon_entropy(factor(c(1,0))) shannon_entropy(factor(c('a','b','c'))) # } # NOT RUN { shannon_entropy(1) shannon_entropy(c('a','b','c')) # }
Run the code above in your browser using DataLab