Hi,

I'm running into memory problems calculating Gi* using dnearneigh and wonder if someone has any suggestions for either my script or another work around.

I have 1km data for Africa. My colleague calculated the appropriate distance band (9333m) using incremental spatial autocorrelation in ArcGIS but she was only able to run a subset of the data or with the data aggregated to 5km due to memory issues (fixed distance, Euclidean). I tried it in both ArcGIS (memory error after 45 hours) and R (Within 2 hours it was using more than 245GB on the server and then crashed). This is what I used

library(spdep)


r<-readOGR(".","r")

coords<-coordinates(r)
nb9333<- dnearneigh(coords, 0,9333,longlat = F) 
nb9333.listw <- nb2listw(include.self(nb9333), style="B")    
G9333<-localG(r$GRID_CODE,nb9333.listw)    


sig3 <- classIntervals(G9333, n=3, style="fixed", 
                       fixedBreaks=c(min(G9333),-3.886, 3.886, max(G9333)))     #I dont' think 3.886 is right
cs<-c('blue','white','red') # blue = below -3, white = intermediate, red = above 3
sigcol <- findColours(sig3, cs)  

png("r.png")
plot(r, col=sigcol, axes=TRUE)
dev.off()

	[[alternative HTML version deleted]]

