shannonZ {SpatEntropy}R Documentation

Shannon's entropy of the transformed variable ZZ.

Description

This function computes Shannon's entropy of variable ZZ, where ZZ identifies pairs of realizations of the variable of interest.

Usage

shannonZ(data)

Arguments

data

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

Details

Many spatial entropy indices are based on the trasformation ZZ of the study variable, i.e. on pairs (unordered couples) of realizations of the variable of interest. 'Unordered couples' means that the relative spatial location is irrelevant, i.e. that a couple where category ii occurs at the left of category jj is identical to a couple where category jj occurs at the left of category ii. When all possible pairs occurring within the observation areas are considered, Shannon's entropy of the variable ZZ may be computed as

H(Z)=p(zr)log(1/p(zr))H(Z)=\sum p(z_r)\log(1/p(z_r))

where p(zr)p(z_r) is the probability of the rr-th pair of realizations, here estimated by its relative frequency. Shannon's entropy of ZZ varies between 0 and log(R)\log(R), R=binom(n+1,2)R=binom(n+1,2) (where nn is the number of observations) being the number of possible pairs of categories of the variable under study. 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

a list of three elements:

Examples

#NON SPATIAL DATA
shannonZ(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)
shannonZ(marks(data.pp))

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


[Package SpatEntropy version 2.2-4 Index]