Learn R Programming

SpatEntropy (version 2.2-4)

varshannon: Estimated variance of Shannon's entropy.

Description

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

Usage

varshannon(data)

Value

the estimated variance of Shannon's entropy.

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.

Examples

Run this code
#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)

Run the code above in your browser using DataLab