Dear GeoR Gurus, I have some raster maps, with continuous values, and I would like to (1) calculate Local Moran's I ; (2) generate a residual map considering different lags. I am trying to follow the Bivand and colleague's book, but I don't know how to generate the neighbour list for each lag.
On the page 268 of book one can find a example of how to plot the moran I index like moran.plot(NY8$Cases, listw=nb2listw (NY_b, style="C")). On the code I read a raster map, vectorize it (each pixel is one polygon), and the pixel value are stored as attribute for the polygon. So, if somebody can help to solve the TWO questions listed above I would be very thanks. Cheers milton ==== require(rgdal) require(adehabitat) (file1 <- paste(system.file(package = "adehabitat"), "ascfiles/elevation.asc", sep = "/")) el <- readGDAL(file1) image(el, axes=T) el.pix <- as(el, "SpatialPixelsDataFrame") el.pol <- as.SpatialPolygons.SpatialPixels(el.pix) str(el.pol, max.level=2) el....@polygons[[1]] plot(el.pol) rn <- sapply(slot(el.pol, "polygons"), function(x) slot(x, "ID")) df <- data.frame(rn=rn, row.names=rn) el.pol.spdf<-SpatialPolygonsDataFrame(el.pol, data=df) el.pol.s...@data$pixvalue<-overlay(el<el.pol.s...@data$pixvalue%3c-overlay(el>, el.pix)@data[,1] image(el, axes=T) plot(el.pol, add=T) head(el.pol.s...@data) [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo