Creates a vector of local depths from a matrix of distances (or dist
object).
Arguments
- d
A matrix of pairwise distances, a
dist
object, or acohesion_matrix
object.
Details
Local depth is an interpretable probability which reflects aspects of relative position and centrality via distance comparisons (i.e., d(z, x) < d(z, y)).
The average of the local depth values is always 1/2. Cohesion is
partitioned local depth (see cohesion_matrix
); the row-sums of the
cohesion matrix are the values of local depth.
Examples
D <- dist(exdata1)
local_depths(D)
#> 1 2 3 4 5 6 7 8
#> 0.4413265 0.5418367 0.4653061 0.6246599 0.4982993 0.6420068 0.5017007 0.2848639
C <- cohesion_matrix(D)
local_depths(C)
#> 1 2 3 4 5 6 7 8
#> 0.4413265 0.5418367 0.4653061 0.6246599 0.4982993 0.6420068 0.5017007 0.2848639
## local depths are the row sums of the cohesion matrix
rowSums(C)
#> 1 2 3 4 5 6 7 8
#> 0.4413265 0.5418367 0.4653061 0.6246599 0.4982993 0.6420068 0.5017007 0.2848639
## cognate distance data
ld_lang <- sort(local_depths(cognate_dist))