0

ここに添付されている R コードを見つけてください。

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)

**主な問題は、地区に近隣のない空間ポイントがいくつかあることです。したがって、生成された空間重み行列を使用してモランの I インデックスを計算しようとすると、隣接しない領域のエラーが表示されます。

一部の空間ポイントに隣接点がない場合に、空間ウェイト マトリックスを調整する方法がわかりません。

私を助けてください。前もって感謝します

4

0 に答える 0