The local spatial statistic G is calculated for each zone based on the spatial weights object used. The value returned is a Z-value, and may be used as a diagnostic tool. High positive values indicate the posibility of a local cluster of high values of the variable being analysed, very low relative values a similar cluster of low values. For inference, a Bonferroni-type test is suggested in the references, where tables of critical values may be found (see also details below).
localG(x, listw, zero.policy=attr(listw,"zero.policy"), spChk=NULL, GeoDa=FALSE, alternative ="two.sided", return_internals=TRUE)localG_perm(x, listw, nsim=499, zero.policy=attr(listw,"zero.policy"), spChk=NULL, alternative ="two.sided", iseed=NULL, fix_i_in_Gstar_permutations=TRUE, no_repeat_in_row=FALSE)
Arguments
x: a numeric vector the same length as the neighbours list in listw
listw: a listw object created for example by nb2listw
zero.policy: default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA
spChk: should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use get.spChkOption()
GeoDa: default FALSE, if TRUE, drop x values for no-neighbour and self-neighbour only observations from all summations
nsim: default 499, number of conditonal permutation simulations
alternative: a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".
return_internals: default TRUE, unused
iseed: default NULL, used to set the seed; the output will only be reproducible if the count of CPU cores across which computation is distributed is the same
fix_i_in_Gstar_permutations: default TRUE (fix x at self in permutations for local G-star), set FALSE to use pre-1.2-8 behaviour
If the neighbours member of listw has a "self.included" attribute set to TRUE, the Gstar variant, including the self-weight wii>0, is calculated and returned. The returned vector will have a "gstari" attribute set to TRUE. Self-weights must be included by using the include.self function before converting the neighbour list to a spatial weights list with nb2listw as shown below in the example.
The critical values of the statistic under assumptions given in the references for the 95th percentile are for n=1: 1.645, n=50: 3.083, n=100: 3.289, n=1000: 3.886.
Returns
A vector of G or Gstar standard deviate values, with attributes "gstari" set to TRUE or FALSE, "call" set to the function call, and class "localG". For conditional permutation, the returned value is the same as for localG(), and the simulated standard deviate is returned as column "StdDev.Gi" in attr(., "internals").
Note
Conditional permutations added for comparative purposes; permutations are over the whole data vector omitting the observation itself, and from 1.2-8 fixing the observation itself as its own neighbour for local G-star.
References
Ord, J. K. and Getis, A. 1995 Local spatial autocorrelation statistics: distributional issues and an application. Geographical Analysis, 27, 286--306; Getis, A. and Ord, J. K. 1996 Local spatial statistics: an overview. In P. Longley and M. Batty (eds) Spatial analysis: modelling in a GIS environment (Cambridge: Geoinformation International), 261--277; Bivand RS, Wong DWS 2018 Comparing implementations of global and local indicators of spatial association. TEST, 27(3), 716--748 tools:::Rd_expr_doi("10.1007/s11749-018-0599-x")