Skip to contents

Solves the coupled reaction-diffusion system $$\partial_t A = \eta \nabla^2 A - \omega A + \theta \rho,$$ $$\partial_t \rho = \nabla \cdot (D \nabla \rho - 2 \rho \nabla \log A) - \rho A + \gamma,$$ on a cosine-corrected Toronto grid seeded by the observed incident histogram. Localised attractiveness spikes emerge whenever \((\eta, \omega, \theta, D, \gamma)\) place the system in the instability regime (D'Orsogna & Perc 2015, sec. 3.2).

Usage

morie_tps_sdb_reaction_diffusion(
  category = "Assault",
  sample_rows = 30000L,
  eta = 0.05,
  omega = 0.3,
  theta = 1.5,
  D = 0.1,
  gamma = 0.05,
  n_steps = 800L,
  dt = 0.04,
  nx = 90L,
  ny = 60L,
  save_fig = TRUE,
  fig_dir = NULL
)

Arguments

category

TPS category name (default "Assault").

sample_rows

Maximum number of incident rows to load (NULL for all).

eta, omega, theta, D, gamma

PDE coefficients.

n_steps

Number of forward-Euler integration steps.

dt

Integration step size.

nx, ny

Grid resolution.

save_fig

Whether to write a 1x3 PNG triptych

fig_dir

Directory to write the PNG into; NULL (the default) skips writing and says so in the result. (seed / A(x,t) / rho(x,t)) to the manifest figure directory.

Value

A morie_rich_result list with the steady-state spike count, mean field values, DBSCAN comparison, and the integration parameters.

Details

Steady-state spike count is compared against a DBSCAN cluster count on the raw incidents (delegated to morie_tps_dbscan_clusters when available).

References

Short MB, D'Orsogna MR, Pasour VB, Tita GE, Brantingham PJ, Bertozzi AL, Chayes LB (2008). A statistical model of criminal behavior. M3AS 18(supp01): 1249-1267.

Examples

# \donttest{
  rr <- morie_tps_sdb_reaction_diffusion(
    "Assault", sample_rows = 5000, n_steps = 200, save_fig = FALSE
  )
#> morie_tps: no local TPS cache for 'Assault'; using the bundled sample from rmoriedata. Fetch the full export with morie_tps_fetch_category().
  print(rr$summary_lines)
#> $Method
#> [1] "Short-D'Orsogna-Brantingham 2008 hot-spot PDE"
#> 
#> $Grid
#> [1] "90x60 cos-corrected, dx~=0.52 km"
#> 
#> $Parameters
#> [1] "eta=0.05 omega=0.3 theta=1.5 D=0.1 gamma=0.05 dt=0.04 steps=200"
#> 
#> $SteadySpikes
#> [1] 128
#> 
#> $DBSCAN_clusters
#> [1] 0
#> 
#> $MeanA
#> [1] 0.7668
#> 
#> $MeanRho
#> [1] 0.1189
#> 
#> $Figure
#> [1] "(skipped)"
#> 
# }