# NearRepeat

NearRepeat is an R package uses the Knox test for space-time clustering to quantify the spatio-temporal association between events. In criminology, this test has been used to identify people and locations that are at disproportionate risk of victimization. Of interest is often not only the ‘same repeat’ victims (people or locations that after a first crime event, are targeted again within a short period thereafter), but also the ‘near repeat’ victims: nearby people or locations that are victimized within a short period after the first crime. For more information, see for example the JDI Analysis Brief.

To install the package, follow the instructions on its GitHub repository.

Several other options exist but have drawbacks:

• Prof. Jerry Ratcliffe’s / Temple University’s Near Repeat calculator only works on Windows (and needs admin rights to execute and write files). It seems this software mislabels the rows and columns of its output files, which may lead to erroneous conclusions.

• the free JDI Near Repeat Toolkit also only works on Windows. However it is not actively supported and does not run on Windows 10.

• the R package surveillance has implemented the knox() function, but this only works for a single spatial distance and temporal distance, whereas the current package also works with multiple bands of spatial and temporal distances, as well as same repeat analysis.

Note that in parallel with the development of the code here, Toby Davies has developed an alternative implementation in Python, which can be found here. We have collaborated on some of the accompanying materials and reviewed each other’s code, and as far as we are aware the two implementations should give identical results.

##### Wouter Steenbeek
###### Senior Researcher

My research interests include spatio-temporal patterns of crime, offender decision-making, neighborhoods, machine learning, and R.