Learn R Programming

SpatEntropy (version 2.2-4)

varshannonZ: Estimated variance of Shannon's entropy of \(Z\).

Description

This function estimates the variance of Shannon's entropy of \(Z\), where \(Z\) identifies pairs of categories of the original study variable.

Usage

varshannonZ(data)

Value

the estimated variance of Shannon's entropy of \(Z\).

Arguments

data

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

Details

varshannonZ estimates the variance of the maximum likelihood estimator of Shannon's entropy of \(Z\) given by shannonZ. The variance is $$V(H(Z))=H(Z)_2- H(Z)^2$$, where $$H(Z)_2=\sum p(z_r)\log(1/p(z_r))^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
data=sample(1:5, 50, replace=TRUE)
varshannonZ(data)

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

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

Run the code above in your browser using DataLab