nonormmoran {GeoXp} | R Documentation |
The function `nonnormmoran' is used to detect spatial autocorrelation in the residuals $u$ from the least squares model Y=beta X+u. It calculates Moran's I statistic of the residuals based on the gaussian asymptotic distribution and give a p-value associated to the test of spatial autocorrelation (gaussian version).
nonormmoran(y, x, W)
y |
vector of size n of dependent variable |
x |
matrix n x p containing explanatory variables |
W |
spatial weight matrix |
W is supposed standartized :
I=(n/s)frac(u'Wu)(u'u)
I sim N(E(I),var(I))
let M=(I-X(X'X)^(-1)X')
E(I)=(n/s)frac(tr(MW))(n-k)
d=frac(n-p)(n+p+2)
V(I)=(n/s)^2[tr(MWMW')+tr(MW)^2+(tr(MW))^2]/d-E(I)^2
Z_I=frac(I-E(I))(v(I)^(1/2))
In the case of W is normed, $s=n$ else $s$ is the number of nonzero links
(nobs,nvar,morani,imean,istat,ivar,prob) where `nobs' is the number of observations,
`nvar', the number of explanatory variables, `morani' is the Moran's $I$ statistic estimate,
`imean' is E(I), ivar is var(I), istat
is the normalized Moran's I statistic
(corresponding to Z_i), and prob
the associated p-value.
Translated into R from Jim Lessage's Spatial Econometrics Toolbox, http://www.spatial-econometrics.com/
Aragon Yves, Perrin Olivier, Ruiz-Gazen Anne, Thomas-Agnan Christine (2009), Statistique et Econométrie pour données géoréférencées : modèles et études de cas
moranplotmap
,neighbourmap
,makeneighborsw
,normw
# data baltimore data(baltimore) W <- makeneighborsw(baltimore$X,baltimore$Y,method="neighbor",4) # W is not normed nonormmoran(baltimore$PRICE,baltimore[,14:15],W) # W is normed nonormmoran(baltimore$PRICE,baltimore[,14:15],normw(W))