View source: R/eig_functions.R
| entropy | R Documentation |
Helper function to compute Shannon entropy for a probability value. Entropy measures uncertainty about guilt/innocence.
entropy(p, base = 2)
p |
Probability value (between 0 and 1) |
base |
Logarithm base (default = 2 for bits) |
Entropy is computed as: H(p) = -[p*log(p) + (1-p)*log(1-p)] When p is 0 or 1 (certainty), entropy is 0. Maximum entropy (1 bit) occurs at p = 0.5 (maximum uncertainty).
Shannon entropy in bits (if base = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.