geary.test {spdep} | R Documentation |
Geary's test for spatial autocorrelation using a spatial weights matrix in weights list form. The assumptions underlying the test are sensitive to the form of the graph of neighbour relationships and other factors, and results may be checked against those of geary.mc
permutations.
geary.test(x, listw, randomisation=TRUE, zero.policy=FALSE, alternative="less", spChk=NULL)
x |
a numeric vector the same length as the neighbours list in listw |
listw |
a listw object created for example by nb2listw |
randomisation |
variance of I calculated under the assumption of randomisation, if FALSE normality |
zero.policy |
if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA |
alternative |
a character string specifying the alternative hypothesis, must be one of "less" (default), "greater" or "two.sided". |
spChk |
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use get.spChkOption() |
A list with class htest
containing the following components:
statistic |
the value of the standard deviate of Geary's C. |
p.value |
the p-value of the test. |
estimate |
the value of the observed Geary's C, its expectation and variance under the method assumption. |
alternative |
a character string describing the alternative hypothesis. |
method |
a character string giving the assumption used for calculating the standard deviate. |
data.name |
a character string giving the name(s) of the data. |
The derivation of the test (Cliff and Ord, 1981, p. 18) assumes that the weights matrix is symmetric. For inherently non-symmetric matrices, such as k-nearest neighbour matrices, listw2U()
can be used to make the matrix symmetric. In non-symmetric weights matrix cases, the variance of the test statistic may be negative (thanks to Franz Munoz I for a well documented bug report). Geary's C is affected by non-symmetric weights under normality much more than Moran's I.
Roger Bivand Roger.Bivand@nhh.no
Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, p. 21.
data(oldcol) geary.test(spNamedVec("CRIME", COL.OLD), nb2listw(COL.nb, style="W")) geary.test(spNamedVec("CRIME", COL.OLD), nb2listw(COL.nb, style="W"), randomisation=FALSE) colold.lags <- nblag(COL.nb, 3) geary.test(spNamedVec("CRIME", COL.OLD), nb2listw(colold.lags[[2]], style="W")) geary.test(spNamedVec("CRIME", COL.OLD), nb2listw(colold.lags[[3]], style="W"), alternative="greater") print(is.symmetric.nb(COL.nb)) COL.k4.nb <- knn2nb(knearneigh(coords.OLD, 4)) print(is.symmetric.nb(COL.k4.nb)) geary.test(spNamedVec("CRIME", COL.OLD), nb2listw(COL.k4.nb, style="W")) geary.test(spNamedVec("CRIME", COL.OLD), nb2listw(COL.k4.nb, style="W"), randomisation=FALSE) cat("Note non-symmetric weights matrix - use listw2U()\n") geary.test(spNamedVec("CRIME", COL.OLD), listw2U(nb2listw(COL.k4.nb, style="W"))) geary.test(spNamedVec("CRIME", COL.OLD), listw2U(nb2listw(COL.k4.nb, style="W")), randomisation=FALSE)