
Jacquez k-nearest-neighbour test for space-time interaction
Source:R/panelspatial.R
morie_jacquez_knn.RdCounts the pairs near in space and near in time, \(J_k = \sum_i \sum_j a_{ij} b_{ij}\), where \(a_{ij}\) marks \(j\) among \(i\)'s \(k\) nearest neighbours in space and \(b_{ij}\) the same in time. Neither indicator is symmetric, so the sum runs over ordered pairs.
Details
The statistic is a count, so it does not depend on the units of the coordinates or the clock and stays valid for irregular regions. That is also why the null is simulated: under no interaction the time labels are exchangeable, so permuting them and ranking the observed count gives \(p = (1 + \#\{J^{(b)} \ge J^{obs}\}) / (1 + B)\).
Mirrors morie.fn.jacqkn on the Python side.