SpatEntropy (version 0.1.0)

contagion: Li and Reynolds' relative contagion index.

Description

This function computes Li and Reynold's contagion index, following Li and Reynolds (1993), starting from data or from the output of leibovici(). References can be found at SpatEntropy.

Usage

contagion(oneill = NULL, n.cat = NULL, data = NULL, adj.mat = NULL,
  missing.cat = NULL, ordered = TRUE)

Arguments

oneill

O'Neill's entropy as the output of leibovici(). If this is provided, nothing else needs to be specified, except for n.cat if wished.

n.cat

Optional, an integer denoting the number of categories of the study variable.

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

The contiguity 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

Li and Reynolds' contagion index, 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: the contagion index is originally thought for areas sharing a border, as O'Neill's entropy. This corresponds to creating a 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, which is \(1-NO\) where \(NO\) is the normalized O'Neill's entropy, i.e. O'Neill's entropy divided by its maximum \(\log(I)\), \(I\) being the number of categories of the variable under study. Couples can be ordered or not (pairs), with ordered couples as the default option since it is the authors' choice. This function also allows to compute contagion for neighbourhood structures different from contiguity, by suitably defining the adjacency matrix.

Examples

Run this code
# NOT RUN {
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)

contag=contagion(oneill)

contag=contagion(data=data, adj.mat=adj.mat)

# }

Run the code above in your browser using DataLab