Description Usage Arguments Details Value Author(s) Examples
This function calculates the Shannon entropy for a discrete random variable with finite n values sample.
1 |
p |
A |
The entropy is calculated by H(x) = -sum_i^n(P(x_i)log_b(P(x_i))).
A numeric
value of entropy is returned.
Ge Tan
1 2 3 4 | x <- c(1, 1, 1, 1)
shannon.entropy(x)
x <- c(1, 0, 0, 0)
shannon.entropy(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.