[R-sig-Geo] correlogram from x,y,z data

Roger Bivand Roger.Bivand at nhh.no
Mon Mar 6 21:58:59 CET 2006


On Mon, 6 Mar 2006, Dr Carbon wrote:

> HI all: Imagine I have a non sp object. How can I make a correlogram of data
> z that are located by x and y? I'm finding the examples in spdep totally
> opaque since I'm starting from coordinate data. Thanks in advance, DrC.
> 

This is a case where a totally non-informative user name and address, and 
the lack of an affiliation, make it very difficult to respond sensibly. 
Ecologists do these things differently from criminologists, 
epidemiologists, and economists. Knowing your affiliation would be very 
informative.

The function in spdep constructs a correlogram from running the moran() 
function along successive lags from nblags(). If distance is not a 
sensible metric and/or if points are not a sensible representation of your 
objects, this is OK. 

If distance is sensible and points are a sensible representation of your
spatial objects, how you proceed will depend on whether your points are
more or less uniformly spread or not. knearneigh()  will adapt better to
non-uniform spreads, otherwise dnearneigh() may suit you better, for a
first distance band ensuring at least that all points have at least one
neighbour. To get the maximum nearest neighbour distance:

x <- runif(100)
y <- runif(100)
k1 <- knn2nb(knearneigh(cbind(x,y)))
k1dists <- nbdists(k1, cbind(x,y))
max(unlist(k1dists))
d_all <- dnearneigh(cbind(x,y), 0, max(unlist(k1dists)))
summary(d_all)

If sp.correlogam() starts with no-neighbour objects, they stay isolated.

Off-CRAN you can find an implementation using distance bands directly in 
the ncf package at:

http://asi23.ent.psu.edu/onb1/software.html

which may suit you better (if a point representation and just distance 
make sense in your research setting).

> library(spdep)
> x <- runif(100)
> y <- runif(100)
> z <- runif(100)
> k1 <- knn2nb(knearneigh(cbind(x,y)))
> m1 <- moran.test(z,nb2listw(k1))
> sp.correlogram(k1, z, .........)
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list