Abstract
Detecting spatial associations via spatial stratified heterogeneity, accounting for spatial dependencies, interpretability, complex interactions, and robust stratification. In addition, it supports the spatial stratified heterogeneity family described in Lv et al. (2025) doi:10.1111/tgis.70032.
Introduction
Spatial Stratified Heterogeneity (SSH) is a fundamental concept in spatial science, describing instances where geographic strata differ significantly from one another. Understanding SSH is key to explaining why variables like disease incidence or crop yield vary across a landscape. Traditional regression models often fail to capture these patterns, particularly when the variance within a specific region (stratum) is significantly smaller than the variance across the entire study area. The gdverse R package provides a unified framework for analyzing SSH, integrating the classic Geodetector methods with modern advancements in automated parameter optimization and local interpretability.
Addressing the Limitations of Traditional Geodetectors
The original Geodetector framework, while powerful, faced several challenges. First, it relied on subjective discretization, where users manually "binned" continuous data, leading to potential bias. Second, it often lacked explicit accounting for spatial dependencies between neighboring units. Finally, while it could detect interactions between factors, explaining the local nature of these interactions remained difficult. gdverse addresses these gaps by offering a comprehensive suite of tools for robust, optimized, and locally explainable spatial models.
Methodology and Core Functions
The package implements a hierarchy of spatial detection techniques. At its foundation are the "Core Four" standard Geodetector tools: the Factor Detector (q-statistic), Interaction Detector, Ecological Detector, and Risk Detector.
A significant advancement in gdverse is the Optimal Parameters Geographical Detector (OPGD). The opgd function automates the testing of various discretization methods—such as quantile or natural breaks—and class numbers to identify parameters that maximize the model's explanatory power.
Beyond these core tools, the package includes specialized functions for advanced analysis:
- Robustness (RGD & RID): Designed to handle noise and outliers that might skew traditional statistics.
- Spatial Association (IDSA & SPADE): Integrates spatial weight matrices directly into the detection process to account for neighbor dependencies.
- Local Interpretability (LESH): Uses Shapley values from game theory to decompose variable contributions at a local level.
- Spatial Rough Sets (SRSRS): A tool for handling nominal (categorical) target variables.
Datasets and Implementation
gdverse includes several built-in datasets for benchmarking, such as ndvi (vegetation index), NTDs (Neural Tube Defects), and synthetic sim data. To handle the computational demands of models like LESH or IDSA, which involve complex combinatorial calculations, the package supports multi-core parallel computing.
Key Insights and Results
The package transforms discretization from a manual task into an optimization problem, enhancing the reproducibility of spatial findings. By bridging global and local analysis through LESH, researchers can map the "Shapley power" of determinants to see which factors dominate in specific sub-regions. The q-statistic remains a central metric, providing an easily interpretable value between 0 and 1 for spatial association. Furthermore, the package offers robust visualization tools based on ggplot2 for interaction matrices and risk maps.
Limitations and Future Work
Despite its strengths, gdverse faces the "curse of dimensionality" in complex models like LESH, where it is recommended to limit analysis to 10 variables or fewer. Additionally, some robust methods may require a Python environment via the reticulate package, and certain models like IDSA necessitate continuous input data for optimal performance.
Summary updated