Select Page

Author: M. Naser Lessani

Regression analysis is one of the most widely used and well-established methods for examining the effect of one variable on another. Broadly, regression models can be categorized into two types: global and local models. The key difference between them lies in their treatment of spatial variation. Global regression models assume that relationships between variables are constant across space, which can lead to inaccurate representations of real-world patterns when spatial heterogeneity exists. In contrast, local regression models account for spatial variation by allowing the relationship between variables to vary across locations. As a result, local models produce a separate estimated coefficient for each variable at each observation point, enabling a more nuanced understanding of spatially varying relationships. However, identifying local associations and capturing spatial heterogeneity in local models remains challenging, as there is no universally established mechanism for quantifying spatial dependence. This lack of a clear framework poses a significant obstacle to accurately modeling and interpreting spatially varying relationships.

Among the numerous local regression models, the Geographically Weighted Regression (GWR) model has been widely applied across various disciplines, including public health, urban studies, environmental research, housing markets, and crime analysis. The popularity of GWR can be attributed to its relatively straightforward implementation and the availability of tools and software in platforms such as Python, R, and standalone applications. A common feature shared by existing local regression models is the use of a spatial weight matrix, which quantifies spatial dependence between locations based on distance decay. In this framework, observations closer to the regression point receive higher weights, while weights decrease as the distance increases—a concept grounded in Tobler’s First Law of Geography. However, in today’s digital and globalized world, physical proximity does not always imply actual relatedness. For example, social media has enabled individuals to form close connections in digital space regardless of physical location. A content creator can influence followers across the globe, despite having no geographical closeness to them. Thus, relying solely on physical distance as a measure of spatial association or interaction can lead to a misrepresentation of the underlying spatial patterns.

Similarity and Geographically Weighted Regression (SGWR) is a new local regression model developed to address the limitations of traditional local models by incorporating both geographical distance and attribute similarity when quantifying spatial dependency (or spatial similarity). In SGWR, the spatial weight matrix is constructed as a combination of these two dimensions, allowing for a more accurate representation of spatial interactions between locations. This approach acknowledges a key insight from real-world experience: geographical proximity does not always imply a high degree of interaction between locations. By integrating both spatial and attribute-based similarities, SGWR offers a more comprehensive and realistic framework for modeling spatial processes. For example, property values may differ drastically across a river, and geological features such as fault zones can cause abrupt spatial discontinuities. In agriculture, a large mature tree located farther from a sapling may exert more influence through competition for sunlight or water than a nearby sapling would. Likewise, in the case of natural events like floods or winds, the direction of flow matters more than simple distance, as downstream areas experience greater impacts regardless of their lateral proximity. These examples underscore the limitation of relying solely on geographical distance to assess spatial dependency. Therefore, accounting for both the physical distance between locations and the similarity of their attributes can provide a more realistic and comprehensive understanding of spatial relationships.

To make the SGWR model more accessible, we developed a Python package along with a Graphical User Interface (GUI) tool. The Python package includes both serial and parallel implementations of the model. In both the Python package and the GUI tool, users can run the model using either a fixed Gaussian kernel or an adaptive bisquare Gaussian kernel. Additionally, I have provided a detailed demo that explains how to install both the Python package and the GUI, as well as how to run the parallel version and GUI after installation. For the serial version, a Jupyter Notebook is available in my GitHub repository, which users can follow step-by-step to run the model. Additionally, users can run the classical GWR model using our Python package and GUI tool, as demonstrated in the demo video and detailed in the GitHub repository.

Download the GUI tool: https://github.com/Lessani252/FastSGWR

References:

  1. Lessani, M. N., & Li, Z. (2024). SGWR: similarity and geographically weighted regression. International Journal of Geographical Information Science, 38(7), 1232–1255. https://doi.org/10.1080/13658816.2024.2342319
  2. Lessani, M. N., & Li, Z. (2025). Enhancing the computational efficiency of the SGWR model and introducing its software implementation. Annals of GIS, 1–16. https://doi.org/10.1080/19475683.2025.2523739
  3. Fotheringham, A.S., Chris, B., and Martin, C., (2003). Geographically weighted regression: The analysis of spatially varying relationships. Hoboken, NJ: John Wiley & Sons.
  4. Tobler, W.R., (1970). A computer movie simulating urban growth in the Detroit region. Economic Geography, 46, 234–240.

Parallel Implementation of the SGWR Model

 

Software Implementation of the SGWR Model