SpatEntropy (version 0.1.0)

leibovici: O'Neill's and Leibovici's entropy.

Description

This function computes Leibovici's entropy according to a chosen distance \(d\) (with O'Neill's entropy as a special case) following Leibovici (2009), see also Altieri et al (2017). References can be found at SpatEntropy.

Usage

leibovici(data, adj.mat, missing.cat = NULL, ordered = TRUE)

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.mat

An adjacency matrix, upper- or lower-triangular. Provided by user or generated by adj_mat().

missing.cat

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

ordered

Logical, T if the entropy is computed using ordered couples (see couple_count()), F if it is computed using pairs (see pair_count()).

Value

Leibovici's spatial entropy value (O'Neill's entropy when contiguity is considered) as well as a summary table containing the couples (or pairs) along with their absolute and relative frequencies.

Details

This index is based on the transformed variable \(Z\) identifying couples of realizations of the variable of interest. A distance of interest is fixed, which in the case of O'Neill's entropy is the contiguity, i.e. sharing a border for lattice data; this corresponds to creating an adjacency (contiguity) matrix as done by adj_mat(). Then, all couples of realizations of the variable of interest identified by the adjacency matrix are counted and their relative frequencies are used to compute the index with the traditional Shannon's formula. Couples can be ordered or not (pairs), with ordered couples as the default option being the authors' choice.

Examples

Run this code
# NOT RUN {
##O'NEILL
dist.mat=euclid_dist(cbind(rep(1:5, each=5), rep(1:5,5)))
adj.mat=adj_mat(dist.mat, dd1=dist.mat[1,2]) #for the contiguity matrix
data=sample(1:3, 25, replace=TRUE)
oneill=leibovici(data, adj.mat)

##LEIBOVICI
dist.mat=euclid_dist(cbind(rep(1:5, each=5), rep(1:5,5)))
adj.mat=adj_mat(dist.mat, dd1=4) #for the contiguity matrix
data=sample(1:3, 25, replace=TRUE)
leib=leibovici(data, adj.mat)

# }

Run the code above in your browser using DataLab