lmorn
Local Moran (LISA)
lmorn(x, w, nsim = 0, seed = NULL)Anselin’s (1995) local indicator of spatial association for each unit:
with z = x - mean(x) and m2 = mean(z^2), I_i = z_i / m2 sum_j w_ij z_j, its expectation and variance under total randomisation, the
two-sided normal p-value, and a conditional permutation p-value: unit i
keeps its value and its neighbours’ values are drawn without replacement
from the others, nsim times from seed. The quadrant tells
high-high and low-low clusters from high-low and low-high outliers. The
p-values are per unit and not adjusted for the many tests made (use
stats::p.adjust()); with row-standardised weights the sum of the I_i
is S0 times global Moran’s I. That identity is proved in Lean: see
proof("lmorn").
Parameters
Section titled “Parameters”xThe values: finite numbers, one per unit.
wThe weights:
spwt()’s list, or an spdeplistwobject, for as many units asx.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 unit: ii (I_i), e, v, z,
p, pperm ((1 + min(#{I* >= I}, #{I* <= I})) / (nsim + 1), NaN
without permutations) and quad (1 high-high, 2 low-low, 3 low-high,
4 high-low, 0 neither).
References
Section titled “References”Anselin, L. (1995). Local indicators of spatial association: LISA. Geographical Analysis, 27(2), 93-115. doi:10.1111/j.1538-4632.1995.tb00338.x
Examples
Section titled “Examples”set.seed(1)p <- cbind(x = runif(60), y = runif(60))v <- ifelse(p[, 1] > 0.7 & p[, 2] > 0.7, 5, 1) + rnorm(60, sd = 0.3)l <- lmorn(v, spwt(p, k = 5), nsim = 199, seed = 1)head(l)Generated from the R help page: lmorn in the R reference.