[R] contiguity matrix (queens case)

Gary Nobles G.R.Nobles at rug.nl
Mon Nov 1 14:51:11 CET 2010


i have a grid of points at regular intervals (taken from a raster).

I want to create a listw matrix based on a queens case senario, like this

1 1 1
1 1 1
1 1 1

and also like this

1  1  1  1  1
1  1  1  1  1
1  1  1  1  1
1  1  1  1  1
1  1  1  1  1

and so on


I want it to work with localG from package spdep:
localG(x, listw, zero.policy=NULL, spChk=NULL)

I can use nb2listw, I also want the matrix to use the observation value so
the Gstar optioon, I quote:

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 can be included by using the
include.self function in the
spweights package before converting the neighbour list to a spatial weights
list with nb2listw as
shown below in the example.

Any help is much appreciated, I am slowly getting there!

Thanks

Gary
-- 
View this message in context: http://r.789695.n4.nabble.com/contiguity-matrix-queens-case-tp3022184p3022184.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list