Computes Moran's Eigenvector Maps (MEMs) from a distance matrix. Returns only eigenvectors with positive spatial autocorrelation, which capture broad to medium-scale spatial patterns.
mem(distance.matrix = NULL, distance.threshold = 0, colnames.prefix = "mem")Data frame where each column is a MEM (spatial predictor) representing a different scale of spatial pattern. Columns are named with the pattern <prefix>_<number> (e.g., "mem_1", "mem_2").
Numeric distance matrix between spatial locations.
Numeric value specifying the maximum distance for spatial neighbors. Distances above this threshold are set to zero. Default: 0 (no thresholding).
Character string used as prefix for column names in the output. Default: "mem".
Moran's Eigenvector Maps (MEMs) are spatial variables that represent spatial structures at different scales. The function creates MEMs through the following steps:
Double-centers the distance matrix using double_center_distance_matrix()
Computes eigenvectors and eigenvalues using base::eigen()
Normalizes eigenvalues by dividing by the maximum absolute eigenvalue
Selects only eigenvectors with positive normalized eigenvalues
Positive vs. negative eigenvalues:
Eigenvectors with positive eigenvalues represent positive spatial autocorrelation (nearby locations are similar), capturing broad to medium-scale spatial patterns. Eigenvectors with negative eigenvalues represent negative spatial autocorrelation (nearby locations are dissimilar) and are excluded. The returned MEMs are ordered by eigenvalue magnitude, with the first columns capturing the broadest spatial patterns.
These MEMs are used as spatial predictors in rf_spatial() to account for spatial autocorrelation in model residuals.
mem_multithreshold(), rf_spatial(), double_center_distance_matrix()
Other spatial_analysis:
filter_spatial_predictors(),
mem_multithreshold(),
moran(),
moran_multithreshold(),
pca(),
pca_multithreshold(),
rank_spatial_predictors(),
residuals_diagnostics(),
residuals_test(),
select_spatial_predictors_recursive(),
select_spatial_predictors_sequential()
data(plants_distance)
# Compute MEMs from distance matrix
mems <- mem(distance.matrix = plants_distance)
# View structure
head(mems)
dim(mems)
# Check column names
colnames(mems)[1:5]
Run the code above in your browser using DataLab