Spatial Kernel Density Estimation¶
Spatial Kernel Density Estimation (Spatial KDE) is an extension of KDE for analyzing geospatial data.
It works with the same approach as KDE, i.e., selecting a Kernel Function, choosing a bandwidth, and calculate the density for every spatial sampling unit (grid cells).
How every event points contribute to the density of each sample grid cell?

Impacts from near by points to each cell.
![Spatial KDE in a nutshell. For more information, please see Bailey and Gatrell 1995. Interactive Spatial Data Analysis. Anderson 2009]](/geo-stat-vis/build/SpatialKDE_inanutshe-ee59dfe47eaa544203e23846295222e5.png)
Spatial KDE in a nutshell. For more information, please see Bailey and Gatrell 1995. Interactive Spatial Data Analysis. Anderson 2009]
Calculation of Spatial KDE¶
The sum of 2-D kernel functions.

The sum of bell shape kernels for every cell in the grid Levine 2013. Crimestat 4.
Spatial KDE vs. aggregated count by cell¶
When using a grid-based approach for spatial data analysis, counting points in each cell might only reveal random distribution if the grid cell size is too small (the lower figure). In such cases, the counting result is not useful in presenting the spatial pattern.
Density estimation techniques, such as spatial KDE (middle figure), can help identify the spatial structure and trends within the data. These methods can effectively highlight areas with high concentration versus low concentration, as well as capture the changing rates and other essential aspects of spatial patterns.

Demonstration of KDE.
Example of Spatial KDE¶

Health care POI @ Queenstown

Commercial POI @ Queenstown

Education POI @ Queenstown

Food POI @ Queenstown

Beverages POI @ Queenstown

Outdoor Activity POI @ Queenstown
Bandwidth Selection in Spatial KDE¶
With smaller bandwidth values, the density estimates are more localized and highlight finer details of the data distribution, which could be similar to the distribution of aggregated count by cell---seems random. As the bandwidth increases, the KDE maps start to emphasize broader spatial patterns and general trends in the data. This smoother representation of density may help identify larger-scale features and regional differences while potentially overlooking local variations in the data.

E.g., Health POI @ Queenstown

KDE with different bandwidths
Kernel Functions for Spatial KDE¶
(a) Gaussian (b) Epanechnikov (c) Triangular (d) Uniform
All kernel functions have a rounded base shape.

Kernel functions (height-dimension) for 2D spatial data. See Fouedjio et al. 2017.

Examples and differences between threee Kernel Functions using the same dataset.
Visualizing Spatial KDE¶

Example of Spatial KDE visualisation: Chin 2023

Example of Spatial KDE visualisation: Xia et al. 2024

Example of Spatial KDE visualisation: Wheeler 2014

Example of Spatial KDE visualisation: Yang et al. 2019

Example of Spatial KDE visualisation: Kuo et al. 2012

Example of Spatial KDE visualisation: Levine 2013
Edge Effects¶
Edge effects in KDE refer to the bias and inaccuracy in density estimates near the boundary of the study area due to the lack of data beyond the edges.

Effects of the edges where the external data is not included.
Methods addressing edge effects¶
Reflection Method: Mirror the data points across the boundary, creating a new set of points outside the study area. Apply KDE to this extended dataset, ensuring the density estimates near the boundary are influenced by the reflected points, reducing edge effects.
Gaussian Truncation: Truncate the Gaussian kernel function used in KDE at the boundary of the study area. This method eliminates the need to make assumptions about the data beyond the boundary, as the truncated kernel function only considers the points within the study area.
Adaptive Kernel Methods: Utilize adaptive kernel functions, where the kernel shape and bandwidth vary based on the local density of points. By adapting to the local density, these methods can help reduce edge effects and produce more accurate density estimates near the boundary.
Boundary Correction Methods: Apply boundary correction methods, such as the bias-correction method proposed by Chen and Firth (2000), which adjusts the density estimates near the boundary to compensate for edge effects.
Expansion of the Study Area: Expand the study area beyond the original boundary, ensuring that the kernel function extends beyond the actual area of interest. This approach eliminates edge effects but may introduce uncertainty in density estimates for areas without data.
Advanced Techniques and Applications¶
Dual KDE
Space-time KDE
Network KDE
Dual KDE¶

See Jansenberger & Staufer-Steinnocher 2004 for more details
Space-time KDE¶

See Hu et al. 2018 for more details
Network KDE¶

See Tang et al. 2016 for more details
Summary¶
Introduction: Spatial KDE is an extension of KDE for analyzing spatial data, focusing on patterns, trends, and density variations within a geographic context.
Applications: Spatial KDE is widely used in fields like ecology, crime analysis, epidemiology, and urban planning to identify hot spots, clusters, and spatial relationships.
Spatial Adaptations: Spatial KDE adapts traditional KDE by incorporating techniques to handle edge effects and the specific characteristics of spatial data.
Kernel Functions: Different kernel functions can be used in spatial KDE to accommodate various data distributions and spatial patterns, ensuring accurate density estimation.
Bandwidth Selection: Choosing an appropriate bandwidth for spatial KDE is crucial for accurate density estimation and pattern identification. Methods include rule-of-thumb, cross-validation, and plug-in approaches.
Visualization: Spatial KDE results are typically visualized as heatmaps, contour plots, or 3D surfaces to facilitate interpretation and communication of spatial patterns and trends.
Capturing Local Point Patterns with Spatial KDE¶
Spatial KDE is an effective method for capturing and visualizing local point patterns in spatial data.
By estimating density using a moving kernel window, spatial KDE highlights areas of high and low concentration within the study area.
Bandwidth selection plays a crucial role in capturing local point patterns, as it controls the level of smoothing and the size of the local neighborhood considered in the density estimate.
Smaller bandwidths capture finer details and local variations, while larger bandwidths highlight broader spatial trends and regional differences.
Visualizing spatial KDE results as heatmaps or contour plots allows for easy identification of hotspots, clusters, and spatial relationships within the data.
Spatial KDE does not provide related statistical tests to assess the significance level of the identified patterns or differences between point patterns. Additional statistical methods may be required for a more comprehensive analysis.
- Anderson, T. K. (2009). Kernel density estimation and K-means clustering to profile road accident hotspots. Accident Analysis & Prevention, 41(3), 359–364. 10.1016/j.aap.2008.12.014
- Fouedjio, F., Hill, E. J., & Laukamp, C. (2017). Geostatistical clustering as an aid for ore body domaining: case study at the Rocklea Dome channel iron ore deposit, Western Australia. Applied Earth Science, 127(1), 15–29. 10.1080/03717453.2017.1415114
- Chin, W. C. B. (2023). Delineating Zones of Disease Diffusion from the Amenity-Sharing Network in Peninsular Malaysia. In Earth Data Analytics for Planetary Health (pp. 143–167). Springer Nature Singapore. 10.1007/978-981-19-8765-6_8
- Xia, R., Genovese, P. V., Li, Z., & Zhao, Y. (2024). Analyzing spatiotemporal features of Suzhou’s old canal city: an optimized composite space syntax model based on multifaceted historical-modern data. Heritage Science, 12(1). 10.1186/s40494-024-01499-5
- Yang, J., Zhu, J., Sun, Y., & Zhao, J. (2019). Delimitating Urban Commercial Central Districts by Combining Kernel Density Estimation and Road Intersections: A Case Study in Nanjing City, China. ISPRS International Journal of Geo-Information, 8(2), 93. 10.3390/ijgi8020093
- Hu, Y., Wang, F., Guin, C., & Zhu, H. (2018). A spatio-temporal kernel density estimation framework for predictive crime hotspot mapping and evaluation. Applied Geography, 99, 89–97. 10.1016/j.apgeog.2018.08.001
- Tang, L., Kan, Z., Zhang, X., Sun, F., Yang, X., & Li, Q. (2015). A network Kernel Density Estimation for linear features in space–time analysis of big trace data. International Journal of Geographical Information Science, 30(9), 1717–1737. 10.1080/13658816.2015.1119279