View source: R/double_center_distance_matrix.R
| double_center_distance_matrix | R Documentation |
Double-centers a distance matrix by converting it to weights and centering to zero row and column means. Required for computing Moran's Eigenvector Maps.
double_center_distance_matrix(distance.matrix = NULL, distance.threshold = 0)
distance.matrix |
Numeric distance matrix. Default: |
distance.threshold |
Numeric distance threshold for weight calculation. Distances above this threshold are set to 0 during weighting. Default: |
Double-centering is performed in two steps:
Convert distances to weights using weights_from_distance_matrix()
Center the matrix: subtract row means, subtract column means, and add the grand mean
The resulting matrix is symmetric with zero row and column means, suitable for Moran's Eigenvector Maps computation.
Double-centered numeric matrix with the same dimensions as distance.matrix. The matrix has row means and column means of zero.
weights_from_distance_matrix(), mem(), mem_multithreshold()
Other preprocessing:
auto_cor(),
auto_vif(),
case_weights(),
default_distance_thresholds(),
is_binary(),
make_spatial_fold(),
make_spatial_folds(),
the_feature_engineer(),
weights_from_distance_matrix()
data(plants_distance)
# Double-center the distance matrix
centered <- double_center_distance_matrix(
distance.matrix = plants_distance
)
# Verify row means are zero
head(rowMeans(centered))
# Verify column means are zero
head(colMeans(centered))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.