shannonZ {SpatEntropy} | R Documentation |
Shannon's entropy of the transformed variable
.
Description
This function computes Shannon's entropy of variable ,
where
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 |
Details
Many spatial entropy indices are based on the trasformation 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
occurs at the left of category
is identical to a couple
where category
occurs at the left of category
.
When all possible pairs occurring within the observation areas are considered,
Shannon's entropy of the variable
may be computed as
where is the probability of the
-th pair of realizations, here
estimated by its relative frequency.
Shannon's entropy of
varies between 0 and
,
(where
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:
-
shannZ
Shannon's entropy of -
range
The theoretical range of Shannon's entropy of, from 0 to
-
rel.shannZ
Shannon's relative entropy of -
probabilities
a table with absolute frequencies and estimated probabilities (relative frequencies) for allcategories (data pairs)
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)