View source: R/pald_functions.R
cohesion_matrix | R Documentation |
Creates a matrix of (pairwise) cohesion values from a matrix of pairwise
distances or a dist
object.
cohesion_matrix(d)
d |
A matrix of pairwise distances or a |
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()
.
The matrix of cohesion values. An object of class cohesion_matrix
.
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.