moranI {DCluster} | R Documentation |
Compute Moran's I autocorrelation statistic using residuals or SMRs by means of function moran from package spdep.
moranI.stat(data, applyto="residuals", ...)
data |
A dataframe containing the data, as specified in the DClustermanpage. |
applyto |
A string with the name of the statistic with which calculate Moran's Index. It may be either residulas or SMR. |
... |
Additional arguments needed by function moran from package spdep |
The value of the statistic computed.
Moran, P. A. P. (1948). The interpretation os statistical maps. Journal of the Royal Statistical Society, Series B 10, 243-251.
DCluster, moran, moranI, moranI.boot, MoranI.pboot
library(spdep) data(nc.sids) col.W <- nb2listw(ncCR85.nb, zero.policy=TRUE) sids<-data.frame(Observed=nc.sids$SID74) sids<-cbind(sids, Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74) ) moranI.stat(data=sids, listw=col.W, n=length(ncCR85.nb), S0=Szero(col.W) ) moranI.stat(data=sids, applyto="SMR", listw=col.W, n=length(ncCR85.nb), S0=Szero(col.W) )