pair_count: Build pairs (unordered couples) in a dataset.
Description
This function builds and counts the number of all types of pairs in a data vector or matrix,
according to a chosen adjacency matrix.
Usage
pair_count(data, adj.mat, missing.cat = NULL)
Arguments
data
A 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.
Value
The number of pairs, and a table with absolute and relative frequencies
for each pair of categories.
Details
This function needs a data matrix or data vector of any type (numeric, factor, character, ...),
and an adjacency matrix as generated by adj_mat(). It returns all the data pairs
identified by the adjacency matrix, i.e. occurring at the chosen neighbourhood distance.
Relative and absolute frequencies for all possible pairs are returned, and may be used
for computation of spatial entropy at the chosen distance range.
'Unordered couple', i.e. 'pair', means that the relative spatial location is irrelevant, i.e. that a couple
where category \(i\) occurs at the left of category \(j\) is identical to a couple
where category \(j\) occurs at the left of category \(i\).