View source: R/moran_multithreshold.R
| moran_multithreshold | R Documentation |
Computes Moran's I at multiple distance thresholds to assess spatial autocorrelation across different neighborhood scales. Identifies the distance threshold with the strongest spatial autocorrelation.
moran_multithreshold(
x = NULL,
distance.matrix = NULL,
distance.thresholds = NULL,
verbose = TRUE
)
x |
Numeric vector to test for spatial autocorrelation. Typically model residuals or a response variable. |
distance.matrix |
Numeric distance matrix between observations. Must have the same number of rows as the length of |
distance.thresholds |
Numeric vector of distance thresholds defining different neighborhood scales. Each threshold specifies the maximum distance for spatial neighbors at that scale. Default: |
verbose |
Logical. If |
This function applies moran() at multiple distance thresholds to explore spatial autocorrelation at different spatial scales. This multi-scale approach is valuable for several reasons:
Scale exploration: Different processes may operate at different spatial scales. Testing multiple thresholds reveals the scale(s) at which spatial autocorrelation is strongest.
Optimal neighborhood definition: Identifies the distance threshold that best captures the spatial structure in the data.
Uncertainty assessment: Spatial neighborhoods are often uncertain in ecological and spatial data. Testing multiple thresholds accounts for this uncertainty.
Interpreting results:
The plot shows Moran's I values across distance thresholds. Peaks in Moran's I indicate spatial scales where autocorrelation is strongest. The max.moran and max.moran.distance.threshold values identify the optimal scale. Significant results (p equal or lower than 0.05) indicate spatial autocorrelation at that particular scale.
This function is commonly used to:
Detect spatial autocorrelation in model residuals at multiple scales
Determine appropriate distance thresholds for generating spatial predictors with mem_multithreshold()
Assess whether spatial patterns vary across scales
List with four elements:
per.distance: Data frame with one row per distance threshold, containing columns:
distance.threshold: Distance threshold used
moran.i: Observed Moran's I statistic
moran.i.null: Expected Moran's I under null hypothesis
p.value: Two-tailed p-value
interpretation: Text interpretation of the result
plot: ggplot object showing how Moran's I varies across distance thresholds, highlighting significant results.
max.moran: Numeric value of the maximum Moran's I observed across all thresholds.
max.moran.distance.threshold: Distance threshold (in distance matrix units) where Moran's I is maximized.
moran(), mem_multithreshold(), default_distance_thresholds(), get_moran()
Other spatial_analysis:
filter_spatial_predictors(),
mem(),
mem_multithreshold(),
moran(),
pca(),
pca_multithreshold(),
rank_spatial_predictors(),
residuals_diagnostics(),
residuals_test(),
select_spatial_predictors_recursive(),
select_spatial_predictors_sequential()
data(plants_df, plants_distance, plants_response)
# Test spatial autocorrelation at multiple distance thresholds
moran_multi <- moran_multithreshold(
x = plants_df[[plants_response]],
distance.matrix = plants_distance,
distance.thresholds = c(0, 1000, 5000)
)
# View results for all thresholds
moran_multi$per.distance
# Find optimal distance threshold
moran_multi$max.moran.distance.threshold
moran_multi$max.moran
# Plot shows spatial autocorrelation across scales
moran_multi$plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.