Current version: GD v10.3


Citation for package GD

To cite GD R package in publications, please use:

Song, Y., Wang, J., Ge, Y. & Xu, C. (2020) “An optimal parameters-based geographical detector model enhances geographic characteristics of explanatory variables for spatial heterogeneity analysis: Cases with different types of spatial data”, GIScience & Remote Sensing. 57(5), 593-610. doi: 10.1080/15481603.2020.1760434.


Authors’ affiliations

Dr. Yongze Song

Google Scholar, ResearchGate

Research interests: Spatial statistics, sustainable infrastructure

Curtin University, Australia



1. Introduction to GD package

1.1 The model can be used to address following issues:

  • Explore potential factors or explanatory variables from a spatial perspective.

  • Explore potential interactive impacts of geogrpahical variables.

  • Identify high-risk or low-risk regions from potential explanatory variables.

1.2 The GD package makes following steps fast and easy:

  • It contains both supervised and unsupervised spatial data discretization methods, and the optimal spatial discretization method for continuous variables;

  • It contains four primary functions of geographical detectors, including factor detector, risk detector, interaction detector and ecological detector;

  • It can be used to compare size effects of spatial unit;

  • It provides diverse visualizations of spatial analysis results;

  • It contains detailed significance tests for spatial analysis in each step of geographical detectors.

1.4 Advanced models

Currently, there are the following advanced models based on spatial stratified heterogeneity.

Model (Publication) Description
Optimal Parameters-based Geographical Detector (OPGD) (Song et al., 2020) OPGD is used for characterising spatial heterogeneity, identifying geographical factors and interactive impacts of factors, and estimating risks.
Interactive Detector for Spatial Associations (IDSA) (Song et al., 2021) IDSA is used for estimating the power of interactive determinants (PID) from a spatial perspective. The IDSA model considers spatial heterogeneity, spatial autocorrelation, and spatial fuzzy overlay of multiple explanatory variables for calculating PID.
Generalized Heterogeneity Model (GHM) (Luo et al., 2023) GHM is used for characterizing local and stratified heterogeneity within variables and to improve interpolation accuracy.
Geographically Optimal Zones-based Heterogeneity (GOZH) (Luo et al., 2022) GOZH is used for identifying individual and interactive determinants of geographical attributes (e.g., global soil moisture) across a large study area. GOZH can identify optimal spatial zones and compute the maximum power of determinant (PD) values using an Ω-index.
Robust Geographical Detector (RGD) (Zhang et al., 2022) RGD is used for the robust estimation of PD values.


2. Geographical detector model

Spatial stratified heterogeneity can be measured using geographical detectors (Wang et al. 2010, Wang et al. 2016).

Power of determinants is computed using a \(Q\)-statistic:

\[Q=1-\displaystyle \frac{\sum_{j=1}^{M} N_{j} \sigma_{j}^2}{N \sigma^2} \]

where \(N\) and \(\sigma^2\) are the number and population variance of observations within the whole study area, and \(N_{j}\) and \(\sigma_{j}^2\) are the number and population variance of observations within the \(j\) th (\(j\)=1,…,\(M\)) sub-region of an explantory variable.

Please note that in R environment, sd and var functions are used for computing sample standard deviation and sample variance. If sample variance is used in the computation, the equation of \(Q\)-statistic can be converted to:

\[Q=1-\displaystyle \frac{\sum_{j=1}^{M} (N_{j}-1) s_{j}^2}{(N-1) s^2} \]

where \(s^2\) and \(s_{j}^2\) are sample variance of observations in the whole study area and in the \(j\) th sub-region.