moranplotmap {GeoXp} | R Documentation |
The function moranplotmap()
draws a moran plot, used to detect spatial
autocorrelation in the variable var. On the x-axis, is represented var-bar(var)
and on the y-axis W(var-bar(var)), where W is the spatial weight matrix.
It also calcultes Moran's I statistic (see nonnormoran.r) and
give a p-value associated to the autocorrelation test (gaussian version and permutation version).
moranplotmap(long, lat, var, W, flower=FALSE, locmoran=FALSE, listvar=NULL, listnomvar=NULL, carte=NULL, criteria=NULL, label="", cex.lab=1, col="blue",pch=16, xlab=expression((X-bar(X))), ylab=expression(W(X-bar(X))), axes=FALSE, lablong="", lablat="", names.arg=c("H.-H.","L.-H.","L.-L.","H.-L."))
long |
a vector x of size n |
lat |
a vector y of size n |
var |
a vector of numeric values of size n |
W |
A spatial weigth matrix of size n x n |
flower |
if TRUE, link neighbouring sites |
locmoran |
if TRUE, print local Moran's I statistic on the Moran plot |
listvar |
matrix of variables which permit to plot bubbles on map or add a graphic using the tk window |
listnomvar |
a list with names of variables listvar |
carte |
matrix with 2 columns for drawing spatial polygonal contours : x and y coordinates of the vertices of the polygon |
criteria |
a vector of size n of boolean which permit to represent preselected sites with a cross, using the tcltk window |
label |
a list of character of size n with name of site. Names are printed on map after a selection |
cex.lab |
character size of label |
col |
"blue" by default, color of bars on the histogram |
pch |
16 by default, symbol for selected points |
xlab |
a title for the graphic x-axis |
ylab |
a title for the graphic y-axis |
axes |
a boolean with TRUE for drawing axes on the map |
lablong |
name of the x-axis that will be printed on the map |
lablat |
name of the y-axis that will be printed on the map |
names.arg |
names of quadrants of the Moran plot |
For the permutation test, for each drawing the values of the variable $var$ are randomly assigned to the sites. We then calculate Moran'I statistic associated to each drawing and we give the frequency of drawings when Moran'I statistic is lower or equal to the observed Moran'I statistic. Moreover, the function gives the opportunity to link neighbouring sites and gives Local Moran's I statistic. For a site i:
I_i=(var_i-bar(var))sum_jW_ij(var_j-bar(var))
with j not equal to i.
Returns obs
, vector of size n of boolean with selected sites, and Moran'I statistic MORAN
.
In the case of the spatial weigth matrix is not normalized, the Moran'I statistic is not equal to beta used in regression line for model W(X-bar(X))=beta(X-bar(X))+u. That is why the regression line is only drawn in the case of W normalized.
Aragon Y., Thomas-Agnan C., Ruiz-Gazen A., Laurent T., Robidou L.
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
Jim Lesage, ``Spatial Econometrics Toolbox'', http://www.spatial-econometrics.com/
neighbourmap
,makeneighborsw
,normw
,nonormmoran
# data baltimore data(baltimore) W <- makeneighborsw(baltimore$X,baltimore$Y,method="neighbor",4) moranplotmap(baltimore$X,baltimore$Y,baltimore$PRICE,W,label=baltimore$STATION, criteria=(baltimore$PRICE>mean(baltimore$PRICE)),listvar=baltimore, listnomvar=names(baltimore),flower=TRUE,locmoran=TRUE,cex.lab=0.7,pch=5)