Description Usage Arguments Details Value Note Author(s) References See Also Examples
The function moranplotmap()
draws a moran plot, used to detect spatial
autocorrelation in the variable var. On the x-axis, is represented x-bar(x)
and on the y-axis W(x-bar(x)), where W is the spatial weight matrix.
It also calcultes Moran's I statistic (see nonnormoran
) and
give a p-value associated to the autocorrelation test (gaussian version and permutation version).
1 2 3 4 |
sp.obj |
object of class extending Spatial-class |
name.var |
a character; attribute name or column number in attribute table |
listw.obj |
object of class listw |
flower |
if TRUE, link neighbouring sites |
locmoran |
if TRUE, print local Moran's I statistic on the Moran plot |
names.arg |
names of the quadrant of the Moran plot |
names.attr |
names to use in panel (if different from the names of variable used in sp.obj) |
criteria |
a vector of boolean of size the number of spatial units, which permit to represent preselected sites with a cross, using the tcltk window |
carte |
matrix with 2 columns for drawing spatial polygonal contours : x and y coordinates of the vertices of the polygon |
identify |
if not FALSE, identify plotted objects (currently only working for points plots). Labels for identification are the row.names of the attribute table row.names(as.data.frame(sp.obj)). |
cex.lab |
character size of label |
pch |
16 by default, symbol for selected points |
col |
"lightblue3" by default, color of bars on the histogram |
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 |
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=(x_i-bar(x))sum_jW_ij(x_j-bar(x))
with j not equal to i.
In the case where user click on save results
button,
a list is created as a global variable in last.select
object. \$obs, a vector of integer,
corresponds to the number of spatial units selected just before leaving the Tk window, \$MORAN,
a numeric, corresponds to the value of the Moran'I statistic.
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.
Thibault Laurent, Anne Ruiz-Gazen, Christine Thomas-Agnan (2012), GeoXp: An R Package for Exploratory Spatial Data Analysis. Journal of Statistical Software, 47(2), 1-23.
Roger S.Bivand, Edzer J.Pebesma, Virgilio Gomez-Rubio (2009), Applied Spatial Data Analysis with R, Springer.
Jim Lesage, “Spatial Econometrics Toolbox”, http://www.spatial-econometrics.com/
neighbourmap
,makeneighborsw
,normw
,nonormmoran
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ##
# data baltimore
data(baltimore)
# SpatialPoints
baltimore.sp <- SpatialPoints(cbind(baltimore$X,baltimore$Y))
# SpatialPointsDataFrame
baltimore.spdf<-SpatialPointsDataFrame(baltimore.sp,baltimore)
# Spatial Weight Matrix
W.nb <- knn2nb(knearneigh(baltimore.sp, k=4))
# We choose a row standardized spatial weight matrix :
W.listw <- nb2listw(W.nb,style="W")
# moranplotmap with some options
moranplotmap(baltimore.spdf, "PRICE", W.listw ,
flower=TRUE, locmoran=TRUE,criteria=(baltimore.spdf$AC==1),
identify=TRUE)
# comparison with the moran.test function
moran.test(baltimore.spdf$PRICE,W.listw)
##
# data columbus
require("maptools")
example(columbus)
# use of moranplotmap with spatial weight matrix col.gal.nb :
# 1. row-standardized
moranplotmap(columbus,"HOVAL",nb2listw(col.gal.nb,style="W"))
# 2. basic binary
moranplotmap(columbus,"HOVAL",nb2listw(col.gal.nb,style="B"))
# 3. globally standardized
moranplotmap(columbus,"HOVAL",nb2listw(col.gal.nb,style="C"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.