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
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? thanks, Martin BTW thanks everybody for their help with my last problem -> [R] regression for several responses - it worked perfectly
On Monday 30 June 2003 15:23, Barry Rowlingson wrote:> Think you may be looking at the wrong sort of spatial correlation! For > Geary tests you are comparing 'adjacent' objects, where adjacency is > defined however you want - N-nearest neighbours, shared border between > regions etc etc.sorry, I misunderstood the purpose of geary's I test, thanks for this info.> When you say 'sampled data' it sounds more like you've got samples > taken at locations, and you want to investigate spatial correlation as a > function of distance between samples? Am I guessing right?Yes you are right. I want to look for spatial correlation of my samples as a function of distances between sampling sites (x,y coords).> Take a look at some of the R kriging libraries, which will have > functions to plot variograms. This is a plot of something like > E(|Y_i - Y_j|) against distance. > > BazI found variograms() and correlograms(), but is there a way to get the a p-value for spatial correlation? additionaly I found sp.correlogram() but again with this mysterious "nb class". thanks, martin
Apparently Analagous Threads
- Spatial Ananlysis: zero.policy=TRUE doesn't work for no neighbour regions??
- RE: question about spatial correlation with Xs and Ys
- Help on computing Geary's C statistic to test for Spatial Autocorrelation
- Instrumental variable quantile estimation of spatial autoregressive models
- an object of class lm returned by lm?