[R-sig-Geo] Spatial weight matrix - inverse distance

dfamaral at usp.br dfamaral at usp.br
Fri Aug 26 16:28:35 CEST 2016


Dear colleagues, 


I am trying to build an spatial weight matrix type "inverse distance". Searching for some tips in Internet and books, I got this code below and I would like to receive comments from you if it is on the right path: 








AL <- readOGR(dsn=".", "MT_PA_RO_muni") 

names(AL) 

plot(AL) 

coords <- coordinates(AL) 




contnb <- poly2nb(AL, queen = TRUE) 

str(contnb) 




dist <- dnearneigh(coords, d1 = 0, d2 = 380000) 

dlist <- nbdists(dist, coords) 

idlist <- lapply(dlist, function(x) 1/x) 

W <- nb2listw(dist, glist=idlist, style="W") 

W 

attributes(W) 

W$weights 



<blockquote>



</blockquote>

Thank you very much. 


Daniel. 
	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list