nonormmoran {GeoXp} | R Documentation |
The function `nonnormmoran' is used to detect spatial autocorrelation in the residuals $u$ from the least squares model $Y=β times 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 times p$ containing explanatory variables |
W |
spatial weight matrix |
W is supposed standartized :
I=frac{u'Wu}{u'u}
I sim N(E(I),var(I))
let M=(I-X(X'X)^{-1}X')
E(I)=frac{tr(MW)}{n-k}
d=frac{n-p}{n+p+2}
V(I)=[tr(MWMW')+tr(MW)^2+(tr(MW))^2]/d-E(I)^2
Z_I=frac{I-E(I)}{v(I)^{1/2}}
(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 (2008), ``Statistique et Econométrie pour données géoréférencées : modèles et études de cas''
moranplotmap
,neighbourmap
,makeneighborsw
,makedistancew
,normw
# data baltimore data(baltimore) W <- makeneighborsw(baltimore$X,baltimore$Y,4) nonormmoran(baltimore$PRICE,baltimore[,14:15],W)