Skip to contents

Knox (1964) contingency statistic with Monte Carlo permutation inference (Townsley et al. 2003 near-repeat formulation): counts event pairs close in BOTH space and time and compares against the permutation distribution obtained by shuffling event times.

Usage

morie_crim_near_repeat(
  x,
  y,
  times,
  s_threshold,
  t_threshold,
  n_perm = 499L,
  seed = 42L
)

Arguments

x, y

Event coordinates.

times

Event times.

s_threshold

Spatial closeness threshold.

t_threshold

Temporal closeness threshold.

n_perm

Permutations. Default 499.

seed

RNG seed.

Value

List of class "morie_knox": statistic (observed close-pair count), expected, ratio, p.value, n, call.

References

Knox (1964); Townsley, Homel & Chaseling (2003).

Examples

set.seed(3)
morie_crim_near_repeat(runif(60), runif(60), runif(60, 0, 30),
                       s_threshold = 0.1, t_threshold = 3)
#> Knox near-repeat test
#>   close pairs: 11 observed vs 9.6 expected (ratio 1.14)
#>   permutation p = 0.3460 (499 permutations)