I wish to incrementally find the neighbour distance which maximises Moran's I test statistic. I have read that the I values are not comparable across varying spatial weight matrices but that the z-value should be maximised instead. Where can I find/how can I compute the z-value in lm.morantest
from spdep
package? I don't see a z-value either in the value or in the structure of lm.morantest
printed to the console (same applies to moran.test
for a single variable):
library(spdep)
lm.morantest(lm(pat_ct~pub_ct, sca_ct), w_dist, alternative="two.sided")
#Global Moran I for regression residuals
#data:
#model: lm(formula = pat_ct ~ pub_ct, data = sca_ct)
#weights: w_dist
#Moran I statistic standard deviate = 12.155, p-value < 2.2e-16
#alternative hypothesis: two.sided
#sample estimates:
#Observed Moran I Expectation Variance
# 3.556003e-02 -8.665431e-05 8.600474e-06
str(lm.morantest(lm(pat_ct~pub_ct, sca_ct), w_dist, alternative="two.sided"))
#List of 6
# $ statistic : num [1, 1] 12.2
# ..- attr(*, "names")= chr "Moran I statistic standard deviate"
# $ p.value : num [1, 1] 5.39e-34
# $ estimate : Named num [1:3] 3.56e-02 -8.67e-05 8.60e-06
# ..- attr(*, "names")= chr [1:3] "Observed Moran I" "Expectation" "Variance"
# $ method : chr "Global Moran I for regression residuals"
# $ alternative: chr "two.sided"
# $ data.name : chr "\nmodel: lm(formula = pat_ct ~ pub_ct, data = sca_ct)\nweights: w_dist\n"
# - attr(*, "class")= chr "htest"
I assume a minimal reproducible example is not required to answer this generic question.
help(lm.morantest)
.