SpatEntropy (version 0.1.0)

spat_entropy: Altieri's spatial entropy.

Description

This function computes spatial mutual information and spatial residual entropy as in Altieri et al (2017). References can be found at SpatEntropy.

Usage

spat_entropy(data, adj.list, shannZ, missing.cat = NULL)

Arguments

data

A data matrix or vector, can be numeric, factor, character, ... If the dataset is a point pattern, data is the mark vector.

adj.list

A list of adjacency matrices, provided by user or returned by adj_list(). Each element of the list contains a binary adjacency matrix for building pairs at a specific distance, provided by user or returned by adj_mat().

shannZ

The output of shannonZ(): Shannon's entropy of \(Z\) as well as the pairs frequency table.

missing.cat

Optional, a vector with the names of all categories that are absent in data.

Value

A list with elements:

  • mut.global the spatial mutual information

  • res.global the global residual entropy

  • shannZ Shannon's entropy of \(Z\)

  • mut.local the partial information terms

  • res.local the partial residual entropies

  • pwk the spatial weights for each distance range

  • pzr.marg the marginal probability distribution of \(Z\)

  • pzr.cond a list with the conditional probability distribution of \(Z\) for each distance range

  • Q the number of pairs (realizations of \(Z\))

  • Qk the number of pairs for each distance range.

Details

The computation of Altieri's entropy starts from a point or areal dataset, for which Shannon's entropy of the transformed variable \(Z\) (for details see shannonZ) $$H(Z)=\sum p(z_r)\log(1/p(z_r))$$ is computed using all possible pairs within the observation area. Then, its two components spatial mutual information $$MI(Z,W)=\sum p(w_k) \sum p(z_r|w_k)\log(p(z_r|w_k)/p(z_r))$$ and spatial residual entropy $$H(Z)_W=\sum p(w_k) \sum p(z_r|w_k)\log(1/p(z_r|w_k))$$ are calculated in order to account for the overall role of space in determining the data heterogeneity. Besides, starting from a partition into distance classes, a list of adjacency matrices is built using adj_mat(), which identifies what pairs of units must be considered for each class. Spatial mutual information and spatial residual entropy are split into local terms according to the chosen distance breaks, so that the role of space can be investigated.

Examples

Run this code
# NOT RUN {
data=matrix(sample(1:5, 25, replace=TRUE), nrow=5)
plot(as.im(data, W=square(5)))
dist.breaks=c(0,1,2,5,5*sqrt(2))
dist.mat=euclid_dist(coords_pix(square(5), nrow=5, ncol=5))
my.adj.list=adj_list(dist.mat, dist.breaks) #see adj_list
my.shZ=shannonZ(data)
spat_entropy(data=data, adj.list=my.adj.list, shannZ=my.shZ)

# }

Run the code above in your browser using DataCamp Workspace