varshannon: Estimated variance of Shannon's entropy.

View source: R/shannon.R

varshannonR Documentation

Estimated variance of Shannon's entropy.

Description

This function estimates the variance of Shannon's entropy of a variable X.

Usage

varshannon(data)

Arguments

data

A data matrix or vector, can be numeric, factor, character, ... Alternatively, a marked ppp object.

Details

varshannon estimates the variance of the maximum likelihood estimator of Shannon's entropy given by shannon. The variance is

V(H(X))=H(X)_2- H(X)^2

, where H(X)_2 is a version of Shannon's entropy (see shannon) where the information function \log(1/p(x_i)) is squared:

H(X)_2=\sum p(x_i) \log(1/p(x_i))^2

. The function is able to work with lattice data with missing data, as long as they are specified as NAs: missing data are ignored in the computations.

Value

the estimated variance of Shannon's entropy.

Examples

#NON SPATIAL DATA
varshannon(sample(1:5, 50, replace=TRUE))

#POINT DATA
data.pp=runifpoint(100, win=square(10))
marks(data.pp)=sample(c("a","b","c"), 100, replace=TRUE)
varshannon(marks(data.pp))

#LATTICE DATA
data.lat=matrix(sample(c("a","b","c"), 100, replace=TRUE), nrow=10)
varshannon(data.lat)


SpatEntropy documentation built on Nov. 17, 2023, 5:10 p.m.