moran.mc(x, listw, nsim, zero.policy=FALSE, alternative="greater", na.action=na.fail, spChk=NULL)
listw
object created for example by nb2listw
na.fail
), can also be na.omit
or na.exclude
- in these cases the weights list will be subsetted to remove NAs in the data. It may be necessary to set zero.policy to TRUE because this subsetting maget.spChkOption()
htest
and mc.sim
containing the following components:moran
, moran.test
data(oldcol)
sim1 <- moran.mc(spNamedVec("CRIME", COL.OLD), nb2listw(COL.nb, style="W"),
nsim=99)
mean(sim1$res)
var(sim1$res)
summary(sim1$res)
colold.lags <- nblag(COL.nb, 3)
sim2 <- moran.mc(spNamedVec("CRIME", COL.OLD), nb2listw(colold.lags[[2]],
style="W"), nsim=99)
summary(sim2$res)
sim3 <- moran.mc(spNamedVec("CRIME", COL.OLD), nb2listw(colold.lags[[3]],
style="W"), nsim=99)
summary(sim3$res)
Run the code above in your browser using DataLab