nc.sids <- st_read(system.file("shapes/sids.gpkg", package="spData")[1], quiet=TRUE)
rn <- as.character(nc.sids$FIPS)
ncCC89_nb <- read.gal(system.file("weights/ncCC89.gal", package="spData")[1],
region.id=rn)
EBImoran.mc(nc.sids$SID74, nc.sids$BIR74,
nb2listw(ncCC89_nb, style="B", zero.policy=TRUE), nsim=999,
alternative="two.sided", zero.policy=TRUE)
sids.p <- nc.sids$SID74 / nc.sids$BIR74
moran.mc(sids.p, nb2listw(ncCC89_nb, style="B", zero.policy=TRUE),
nsim=999, alternative="two.sided", zero.policy=TRUE)
Run the code above in your browser using DataLab