
lm()
). The helper function listw2U()
constructs a weights list object corresponding to the sparse matrix $\frac{1}{2} ( \mathbf{W} + \mathbf{W}'$lm.morantest(model, listw, zero.policy=FALSE,
alternative = "greater", spChk=NULL)
listw2U(listw)
lm
returned by lm
; weights
and offsets should not be usedlistw
object created for example by nb2listw
get.spChkOption()
htest
containing the following components:lm.LMtests
, lm
data(oldcol)
oldcrime1.lm <- lm(CRIME ~ 1, data = COL.OLD)
oldcrime.lm <- lm(CRIME ~ HOVAL + INC, data = COL.OLD)
lm.morantest(oldcrime.lm, nb2listw(COL.nb, style="W"))
lm.LMtests(oldcrime.lm, nb2listw(COL.nb, style="W"))
lm.morantest(oldcrime.lm, nb2listw(COL.nb, style="S"))
lm.morantest(oldcrime1.lm, nb2listw(COL.nb, style="W"))
moran.test(spNamedVec("CRIME", COL.OLD), nb2listw(COL.nb, style="W"),
randomisation=FALSE)
Run the code above in your browser using DataLab