Tests for the presence of spatial autocorrelation in variables as indicated by the Moran coefficient. The variance is calculated under the normality assumption.
MI.vec(x, W, alternative = "greater", symmetrize = TRUE, na.rm = TRUE)a vector or matrix
spatial connectivity matrix
specification of alternative hypothesis as 'greater' (default), 'lower', or 'two.sided'
symmetrizes the connectivity matrix W by: 1/2 * (W + W') (TRUE/ FALSE)
listwise deletion of observations with missing values (TRUE/ FALSE)
Returns an object of class data.frame that contains the
following information for each variable:
Iobserved value of the Moran coefficient
EIexpected value of Moran's I
VarIvariance of Moran's I (under normality)
zIstandardized Moran coefficient
pIp-value of the test statistic
If x is a matrix, this function computes the Moran
test for spatial autocorrelation for each column.
Estimation of the variance (under the normality assumption)
follows Cliff and Ord (1981), see also Upton and Fingleton (1985).
It assumes the connectivity matrix W to be symmetric.
For inherently non-symmetric matrices, it is recommended to specify
symmetrize = TRUE.
Cliff, Andrew D. and John K. Ord (1981): Spatial Processes: Models & Applications. Pion, London.
Upton, Graham J. G. and Bernard Fingleton (1985): Spatial Data Analysis by Example, Volume 1. New York, Wiley.
Bivand, Roger S. and David W. S. Wong (2018): Comparing Implementations of Global and Local Indicators of Spatial Association. TEST 27: pp. 716 - 748.
data(fakedata)
X <- cbind(fakedataset$x1, fakedataset$x2, fakedataset$x3)
(MI <- MI.vec(x = X, W = W, alternative = "greater", symmetrize = TRUE))
#> I EI VarI zI pI
#> 1 0.311178214 -0.01010101 0.005344193 4.3948248 5.543107e-06 ***
#> 2 0.168757531 -0.01010101 0.005344193 2.4466317 7.209904e-03 **
#> 3 0.009112739 -0.01010101 0.005344193 0.2628276 3.963417e-01