shannonEntr {MethylIT.utils} | R Documentation |
Compute Shannon Entropy of probability vector p.
shannonEntr(p, logbase = 2)
p |
A probability vector, sum(p) = 1. |
logbase |
A positive number: the base with respect to which logarithms |
By definition, if p_i = 0 for some i, the value of the corresponding summ and 0*log(0) is taken to be 0.
counts = sample.int(10) prob = counts/sum(counts) shannonEntr(prob)