[R] Help on computing Geary's C statistic to test for Spatial Autocorrelation

Roger Bivand Roger.Bivand at nhh.no
Mon Feb 9 13:52:06 CET 2009


R User <ruser180 <at> gmail.com> writes:

> 
> Dear Users:
> 
> I have been trying to use the geary.test() function in *R*, but am having
> slight difficulty understanding how I am to apply it in my context.
> I have 2 matrices:
> 
> 1) *n x p* matrix of *n* observations with *p* measurements each. It may be
> noted that this matrix has a spatial dimension to it, as the
> *n*observations are at different geographical locations on a map.
> 2) *n x n* spatial weights matrix (symmetric) with each matrix element being
> an inter-locality weight.

You sent this message to me off-list, as well as to this list, not R-sig-geo. 
Using a general list for specific questions is not a good idea, and asking on 
the list after expecting the package maintainer to get up in the middle of 
his/her sleep just to answer your question isn't either.

If you read the ?geary.test, you would see that you require a single variable,
so analyse each of your columns in turn. You have a weights matrix, but 
geary.test() needs a listw object, so use mat2listw() to construct it.

RSiteSearch() on Geary test takes you directly to the function you need, but
for listw matrix the hits are a bit more diffuse.

Roger Bivand

> 
> Using the above 2 matrices, I am trying to compute the Geary's *C* statistic
> for each of the *p* dimensions and also obtain corresponding *p*-values to
> determine its statistical significance for spatial autocorrelation.
> 
> I will appreciate any help you could provide me in helping me compute the
> same.
> 
> Thanks.
>




More information about the R-help mailing list