cohesion_matrix {pald} | R Documentation |
Cohesion Matrix
Description
Creates a matrix of (pairwise) cohesion values from a matrix of pairwise
distances or a dist
object.
Usage
cohesion_matrix(d)
Arguments
d |
A matrix of pairwise distances or a |
Details
Computes the matrix of (pairwise) cohesion values, C_xw, from a matrix of
pairwise distances or a dist
object. Cohesion is an interpretable probability
that reflects the strength of alignment of a point, w
, to another point, x
.
The rows of the cohesion matrix can be seen as providing neighborhood
weights. These values may be used for defining associated weighted graphs
(for the purpose of community analysis) as in Berenhaut, Moore, and
Melvin (2022).
Given an n x n distance matrix, the sum of the entries in the resulting
cohesion matrix is always equal to n/2.
Cohesion is partitioned local depth (see local_depths
) and thus the row
sums of the cohesion matrix provide a measure of local depth centrality.
If you have a matrix that is already a cohesion matrix and you would like to
add the class, see as_cohesion_matrix()
.
Value
The matrix of cohesion values. An object of class cohesion_matrix
.
References
K. S. Berenhaut, K. E. Moore, R. L. Melvin, A social perspective on perceived distances reveals deep community structure. Proc. Natl. Acad. Sci., 119(4), 2022.
Examples
plot(exdata1)
text(exdata1 + .08, lab = 1:8)
D <- dist(exdata1)
C <- cohesion_matrix(D)
C
## neighbor weights (provided by cohesion) for the 8th point in exdata1
C[8, ]
localdepths <- rowSums(C)