Skip to contents

R parity of morie.tps_spatial: Moran's I (global), LISA (local Moran's Ii) for hot/cold spots, and 2-D kernel density estimation of incident lat/long. Each function accepts a data.frame of incident-level rows with a neighbourhood id column plus WGS84 lat/long columns, and returns a named list carrying numeric outputs alongside a multi-paragraph interpretation so the result prints in a notebook without further post-processing.

Details

Spatial weights are built with an internal base-R k-nearest- neighbours routine; if the optional FNN package is installed it is used for the KNN graph. The 2-D kernel density estimator prefers MASS::kde2d when available, otherwise falls back to a Gaussian density evaluated at the observation points. If spdep is installed, callers can delegate the global Moran's I test to spdep::moran.test via the use_spdep = TRUE switch.

Functions