0

Please find the R codes attached herewith.

library(maptools)
library(spdep)
library(leaflet)
library(RColorBrewer)

#Read polygon shapefile from the directory
chi.poly <- readShapePoly('Immunization.shp')
class(chi.poly)
str(slot(chi.poly,"data"))
summary(chi.poly@data$bcg)
plot(chi.poly)

chi.ols<-lm(bcg~ib+pnc+full_anc, data=chi.poly@data)
summary(chi.ols)

list.queen<-poly2nb(chi.poly, queen=TRUE)
W<-nb2listw(list.queen, style="W", zero.policy=T)
W
moran.lm<-lm.morantest(chi.ols, W, alternative="two.sided")
print(moran.lm)

**The main issue is that the districts have some neighbourless spatial points. Thus when I am trying to compute moran's I index through the generated spatial weight matrix, it is showing an error of neighbourless regions.

I am not getting, how to adjust the spatial weight matrix in case of some of the spatial points having no neighbors.

Please help me out. Thanks in advance

  • How Immunization.shp look like? What do you mean by "neighbourless spatial points" You mean that "immunization.shp" is not really a polygon but point features, like centroids of each region? – yosukesabai Dec 28 '17 at 00:36
  • Immunization.shp is a district level Indian Map file with 640 districts. Some of the districts (Andaman Nicobar, Lakshadweep, etc.) are not linked, i.e. these locations are completely separated from the major country boundary. I don't know how to link it to compute the spatial weight matrix. Immunization.shp is a polygon only which includes districtwise (640) estimates of several indicators, i.e. one estimate of a particular indicator will represent the whole district only. – Apurba Shil Dec 29 '17 at 06:54
  • I see. If they are not contiguous, can you come up with other way to define neighbors? e.g, based on disntance using `dnearneigh`, https://www.rdocumentation.org/packages/spdep/versions/0.7-4/topics/dnearneigh ? Is it a good hypothesis to assume that region close to each other is likely to be spatially correlated even if non contiguous? – yosukesabai Dec 30 '17 at 05:42

0 Answers0