spNetwork: A Package for Network Kernel Density Estimation

This paper introduces the new package spNetwork that provides functions to perform Network Kernel Density Estimate analysis (NKDE). This method is an extension of the classical Kernel Density Estimate (KDE), a non parametric approach to estimate the intensity of a spatial process. More specifically, it adapts the KDE for cases when the study area is a network, constraining the location of events (such as accidents on roads, leaks in pipes, fish in rivers, etc.). We present and discuss in this paper the three main versions of NKDE: simple, discontinuous, and continuous that are implemented in spNetwork. We illustrate how to apply the three methods and map their results using a sample from a real dataset representing bike accidents in a central neighborhood of Montreal. We also describe the optimization techniques used to reduce calculation time and investigate their impacts when applying the three NKDE to a city-wide dataset.

Jeremy Gelb

CRAN packages used

spNetwork, spatstat, rgdal, sp, rgeos, maptools, igraph, Rcpp, future, SpNetwork, SearchTrees, future.apply, RcppArmadillo

CRAN Task Views implied by cited packages

Spatial, HighPerformanceComputing, NumericalMathematics, SpatioTemporal, GraphicalModels, Optimization, Survival


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Gelb, "The R Journal: spNetwork: A Package for Network Kernel Density Estimation", The R Journal, 2021

BibTeX citation

  author = {Gelb, Jeremy},
  title = {The R Journal: spNetwork: A Package for Network Kernel Density Estimation},
  journal = {The R Journal},
  year = {2021},
  note = {https://doi.org/10.32614/RJ-2021-102},
  doi = {10.32614/RJ-2021-102},
  volume = {13},
  issue = {2},
  issn = {2073-4859},
  pages = {561-577}