moran.cluster | R Documentation |
Using the localmoran
function, create a Local Indicators of Spatial Association (LISA) cluster map and corresponding significance map. The maps are made by calculating the LISAs from localmoran
for each of the spatial units and then the statistical significance is evaluated to determine the spatial clusters and outliers.
moran.cluster(x, listw, zero.policy = NULL, polygons, conditional=TRUE,
significant = TRUE, alternative = "two.sided", pleg, ...)
x |
variable to create cluster and significance map |
listw |
a neighbours list with spatial weights. From package spdep:
a listw object. Use |
zero.policy |
by default = NULL, if FALSE stop with error for any empty
neighbour sets, if TRUE permit the weights list to be formed with zero-length
weights vectors. Parameter inherited from the |
polygons |
SpatialPolygons, SpatialPolygonsDataFrame or sfc_POLYGON object |
conditional |
default TRUE: expectation and variance are calculated using the conditional randomization null (Sokal 1998 Eqs. A7 & A8). Elaboration of these changes available in Sauer et al. (2021). If FALSE: expectation and variance are calculated using the total randomization null (Sokal 1998 Eqs. A3 & A4). |
significant |
by default is TRUE, if FALSE the significant map is not created |
alternative |
by default is "two.sided". Type of alternative hypothesis test. Other values are "less" or "greater". |
pleg |
the x and y co-ordinates to be used to position the legend. They can be specified by keyword or in any way which is accepted by |
... |
other graphical parameters as in |
Using the function localmoran
create the Local Indicators of Spatial
Association - LISA Cluster Map and the corresponding Significance Map.
The significance map is done testing the null hypothesis (Ho) of zero spatial
autocorrelation for each spatial unit and then plotting a choropleth map with this
legend values: (Not Significant, p-value=0.05, p-value= 0.01, p-value=0.001,
p-value=0.0001, and Neighborless). Maps can represent concentrations of similar (cluster)
or dissimilar values (spatial outliers). Most significant clustered spatial units are
those with p-values smaller than 0.0001. Not significant clustered spatial units are
those with p-values greater than 0.05. LISA Cluster Map is done based on the
significance map but the choropleth legend is different (Not - Significant, High-High, Low-Low,
Low-High, High-Low, and Neighborless).
two maps
Bivariate Moran's Ixy: moran.bi
Plot Bivariate Moran's Ixy: moranbi.plot
Bivariate Moran's Ixy Test: moranbi.test
Create object "nb": poly2nb
Create object "listw"/"nb": nb2listw
library(spdep)
data(columbus)
columbus <- st_read(system.file("shapes/columbus.gpkg", package="spData")[1])
plot(st_geometry(columbus))
col_nbq <- poly2nb(columbus)
a.lw <- nb2listw(col_nbq, style="W")
moran.cluster(columbus$CRIME, a.lw, zero.policy = FALSE, st_geometry(columbus),
significant=TRUE,pleg = "topleft")
moran.cluster(columbus$CRIME, a.lw, zero.policy = FALSE, st_geometry(columbus),
significant=TRUE,alternative="greater",pleg = "topleft")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.