Skip to contents

Grids the lat/long extent of data into a coarse raster of grid_resolution cells, counts events per cell, and computes the global Moran's I via a rook contiguity matrix. Also runs DBSCAN on the raw lat/long points (rescaled to km) and reports cluster counts.

Usage

mrm_tps_moran_clustering(
  data,
  lat_col = "LAT_WGS84",
  lon_col = "LONG_WGS84",
  grid_resolution = 40L,
  dbscan_eps = 0.3,
  dbscan_minpts = 5L
)

Arguments

data

A data.frame with lat_col and lon_col.

lat_col

Column name of WGS84 latitude.

lon_col

Column name of WGS84 longitude.

grid_resolution

Number of cells per axis (default 40L).

dbscan_eps

DBSCAN radius in km (default 0.3).

dbscan_minpts

DBSCAN minimum points per core (default 5L).

Value

A list with morans_I, morans_z, dbscan_n_clusters, dbscan_n_noise, dbscan_largest.

Details

This function is a thin computational wrapper. For high-precision computations on full-sized TPS files use the morie Python tps_spatial_advanced pipeline; the R version is for quick interactive auditing.

Examples

if (FALSE) {
  tps <- read.csv("Assault_Open_Data.csv")
  mrm_tps_moran_clustering(tps)
}