Skip to content

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.

cnt

Counts per cell: a matrix of whole numbers from 0.

ex

NULL for 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 are NaN).

rad

The neighbourhood radius in cell widths, from 0 to 1000 (1: the cell and its four rook neighbours; 1.5: the queen neighbourhood).

nsim

The number of permutations: a whole number from 0.

seed

NULL to draw the simulations’ seed from R’s generator (so set.seed() fixes them), or one whole number from 0.

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.

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

set.seed(1)
m <- matrix(rpois(100, 2), 10)
m[4:5, 4:5] <- 9
g <- gstr(m)
g[g$qe < 0.05, ]

Generated from the R help page: gstr in the R reference.