November 2018
Beginner to intermediate
354 pages
6h 59m
English
Moran's I index is an index for measuring autocorrelation. To run this test, we need to get neighboring polygons for each polygon, and we'll use the poly2nb() function of the spdep package to make a list of neighbors, a type known as an nb object in the spdep package. Then, we'll need to convert this nb object into a listw object using nb2listw() to create a list of neighbors along with their weights. Let's first create the nb object, a list of neighbors for each polygon in migration_spdef:
library(spdep)neighbor_syl = poly2nb(syl)
Now let's plot this nb object on the map to see what it has done:
plot(syl, col="gray") plot(neighbor_syl, coordinates(syl), add = TRUE, col="blue")
Now we see that the neighborhoods ...
Read now
Unlock full access