View source: R/mem_multithreshold.R
| mem_multithreshold | R Documentation |
Computes Moran's Eigenvector Maps (MEMs) using mem() at multiple distance thresholds and combines them into a single data frame. This creates spatial predictors capturing patterns at different spatial scales.
mem_multithreshold(
distance.matrix = NULL,
distance.thresholds = NULL,
max.spatial.predictors = NULL
)
distance.matrix |
Numeric distance matrix between spatial locations. |
distance.thresholds |
Numeric vector of distance thresholds. Each threshold defines the maximum distance for spatial neighbors at that scale. Default: |
max.spatial.predictors |
Integer specifying the maximum number of spatial predictors to return. If the total number of MEMs exceeds this value, only the first |
This function generates spatial predictors at multiple spatial scales by computing MEMs at different distance thresholds. Different thresholds capture spatial patterns at different scales:
Smaller thresholds (e.g., 0) capture fine-scale spatial patterns
Larger thresholds capture broad-scale spatial patterns
Algorithm:
For each distance threshold, calls mem() to compute MEMs
Each mem() call applies the threshold, double-centers the matrix, and extracts positive eigenvectors
Combines all MEMs into a single data frame
Optionally limits the total number of predictors with max.spatial.predictors
The resulting MEMs are used as spatial predictors in rf_spatial() to model spatial autocorrelation at multiple scales simultaneously.
Data frame with one row per observation (matching distance.matrix dimensions) and columns representing MEMs at different distance thresholds. Column names follow the pattern spatial_predictor_<threshold>_<number> (e.g., "spatial_predictor_0_1", "spatial_predictor_1000_2").
mem(), rf_spatial(), default_distance_thresholds(), double_center_distance_matrix()
Other spatial_analysis:
filter_spatial_predictors(),
mem(),
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 for multiple distance thresholds
mems <- mem_multithreshold(
distance.matrix = plants_distance,
distance.thresholds = c(0, 1000, 5000)
)
# View structure
head(mems)
dim(mems)
# Check column names showing threshold and predictor number
colnames(mems)[1:6]
# Limit number of spatial predictors
mems_limited <- mem_multithreshold(
distance.matrix = plants_distance,
distance.thresholds = c(0, 1000, 5000),
max.spatial.predictors = 20
)
dim(mems_limited)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.