Skip to content
Back to formatted view

Raw Message

Message-ID: <5.2.1.1.0.20030630175223.00b41f38@biomserv.univ-lyon1.fr>
Date: 2003-06-30T16:00:33Z
From: Stéphane Dray
Subject: spatial correlation test
In-Reply-To: <200306301648.22155.baliola@riseup.net>

At 18:48 30/06/2003, Martin Wegmann wrote:
>hello,
>
>I want to do a test for spatial correlation.
>I tried it with geary.test() but I don't understand the required input.
>x= a numeric vector the same length as the neighbours list in listw (my
>sampled data, I assume)
>listw= a listw object created for example by nb2listw (well when I check
>nb2listw() I get to "neighbours - an object of class nb" - but I couldn't
>figure out, what nb is or how I create such a class
>
>with sp.mantel.mc {spdep} I have the same problem: listw created by nb2listw
>
>isn't there a more straight forward method ;-)  to check for spatial
>correlation? like x and y coordinates plus my sampled data?

This functions require a list of spatial weights for each geographical 
unit. To construct this list, you must firstly establish the neighborhood 
relationships (who are the neighbors of a point). There are different ways 
to construct this neighborhood: based on distances (dnearneigh), number of 
nearest neighbors (knearneigh)... Then, you must transform this 
neighborhood to weights (see nb2listw for example). Here is a small example 
requiring the tripack library based on tesselation and voronoi mosaic to 
create the neighboorhood:

xy=matrix(rnorm(20),5,2)
z=rnorm(5)
library(spdep)

mynb=tri2nb(xy)
mylw=nb2listw(mynb)

geary.mc(z,mylw,10)

         Monte-Carlo simulation of Geary's C

data:  z
weights: mylw
number of simulations + 1: 11

There is no simplest method.....


statistic = 0.8384, observed rank = 2, p-value = 0.1818
alternative hypothesis: less