entropy | R Documentation |
Calculus of the Shannon's etropy index.
entropy(x, base = exp(1), inverse = FALSE)
x |
Numeric vector. |
base |
Basis of the logarithm. |
inverse |
Logical specifying if reverse the result by using the inverse function. |
When inverse = T
, the entropy H is corrected by using the formula: base^H.
In this case, the entropy will be included between 1 and the numbers of categories
of x
.
x <- c(1,1,1,1, 2,2,2,2, 3,3,3,3, 4,4,4,4, 5,5,5,5)
entropy(x, inverse=TRUE)
x <- c(0,0,0,0, 1,1,1,1, 2,2,2,2, 3,3,3,3, 4,4,4,4)
entropy(x, inverse=TRUE)
x <- c(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1)
entropy(x, inverse=TRUE)
entropy(x)
x <- c(1,1,1,1, 1,1,1,1, 4,4,5,5, 5,5,5,5, 5,5,5,5)
entropy(x, inverse=TRUE)
entropy(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.