Skip to contents

$$H(x) = -\sum x_i \log x_i$$ Shannon (1948), Sections 6-7; Cover & Thomas (2006), eq. (2.1). The input is closed to unit total first and the closure constant is reported, which is the only difference from Shanent.

Usage

Compshan(x, base = 2)

Arguments

x

Non-negative parts of a composition.

base

Log base; 2 gives bits.

Value

Named list with estimate, closure, evenness, n, method.

References

Shannon (1948), Sections 6-7.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Compshan(V)
#> $estimate
#> [1] 2.794209
#> 
#> $closure
#> [1] 36
#> 
#> $evenness
#> [1] 0.9314029
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Shannon entropy of a composition -- Shannon (1948) Sec. 6"
#>