Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/entropy.plugin.R
entropy.plugin
computes the Shannon entropy H
of a discrete random variable with the specified frequencies (probability mass function).
1 | entropy.plugin(freqs, unit=c("log", "log2", "log10"))
|
freqs |
frequencies (probability mass function). |
unit |
the unit in which entropy is measured.
The default is "nats" (natural units). For
computing entropy in "bits" set |
The Shannon entropy of a discrete random variable is defined as H = -∑_k p(k) \log( p(k) ), where p is its probability mass function.
entropy.plugin
returns the Shannon entropy.
Korbinian Strimmer (https://strimmerlab.github.io).
entropy
, entropy.empirical
, entropy.shrink
,
mi.plugin
, KL.plugin
, discretize
.
1 2 3 4 5 6 7 8 | # load entropy library
library("entropy")
# some frequencies
freqs = c(0.2, 0.1, 0.15, 0.05, 0, 0.3, 0.2)
# and corresponding entropy
entropy.plugin(freqs)
|
[1] 1.66958
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.