gstr
Local Getis-Ord Gi on a grid of counts*
gstr(cnt, ex = NULL, rad = 1.5, nsim = 0, seed = NULL)The local statistic Gi* of Getis and Ord (1992; Ord and Getis 1995) for
each cell of a grid of counts, with binary weights on the cells within
rad cell widths (rad = 1.5: the 3 by 3 block, cell included), its
normal p-value and Benjamini-Hochberg q-value, a conditional permutation
p-value, and an exposure-aware version: given the total, the count of a
neighbourhood is binomial with the neighbourhood’s share of the exposure
under complete spatial randomness, so cells overhanging the study area
neither inflate the mean nor get flagged. No threshold is applied.
Parameters
Section titled “Parameters”cntCounts per cell: a matrix of whole numbers from 0.
exNULLfor equal exposure, or a matrix of the same dimensions: each cell’s exposure (its area inside the study window, say), 0 for a cell outside (its results areNaN).radThe neighbourhood radius in cell widths, from 0 to 1000 (1: the cell and its four rook neighbours; 1.5: the queen neighbourhood).
nsimThe number of permutations: a whole number from 0.
seedNULLto draw the simulations’ seed from R’s generator (soset.seed()fixes them), or one whole number from 0.
Returns
Section titled “Returns”A data frame with one row per cell (down the columns of cnt):
row, col, gz (the classic Gi* z), pz, qz, pp (the
permutation p-value, NaN without permutations), ze (the
exposure-aware z), pe (its exact two-sided binomial p-value) and
qe.
References
Section titled “References”Getis, A. and Ord, J. K. (1992). The analysis of spatial association by use of distance statistics. Geographical Analysis, 24(3), 189-206. doi:10.1111/j.1538-4632.1992.tb00261.x
Ord, J. K. and Getis, A. (1995). Local spatial autocorrelation statistics: distributional issues and an application. Geographical Analysis, 27(4), 286-306. doi:10.1111/j.1538-4632.1995.tb00912.x
Examples
Section titled “Examples”set.seed(1)m <- matrix(rpois(100, 2), 10)m[4:5, 4:5] <- 9g <- gstr(m)g[g$qe < 0.05, ]Generated from the R help page: gstr in the R reference.