hi all, is the below the correct way to access spatial autocorrelation using morans I in a glm: #get coordinates first coords<-as.matrix(cbind(data$long,data$lat)) #model m1 <- glm(response~ predictor1 + predictor 2+ predictor1*predictor2, family=binomial, data=data) # Compute Moran's I using residuals of model lstw <- nb2listw((knn2nb(knearneigh(coords, k=1)))) moran.test(residuals(m1), lstw) Advise from experts using function moran.test will be much appreciated.
Morans I
1 message · Dechen Lham