Skip to contents

$$h(X) = -\int f(x)\log f(x)\,dx$$ Cover & Thomas (2006), eq. (8.1), p. 243. Trapezoid rule on the supplied grid – a fixed node set, never adapted.

Usage

Difent(density, x = NULL, base = 2)

Arguments

density

Non-negative density values at the grid points.

x

Grid; defaults to seq(0, 1, length.out = length(density)).

base

Log base; 2 gives bits, NULL gives nats.

Value

Named list with estimate, mass, n, base, method.

References

Cover & Thomas (2006), eq. (8.1).

Examples

Difent(c(1, 1, 1))
#> $estimate
#> [1] 0
#> 
#> $mass
#> [1] 1
#> 
#> $n
#> [1] 3
#> 
#> $base
#> [1] 2
#> 
#> $method
#> [1] "Differential entropy h(X) -- Cover & Thomas (2006) eq. (8.1)"
#>