
Given two continuous numeric variables, calculate the bivariate Local Moran's I.
localmoran_bv(x, y, listw, nsim = 199, scale = TRUE, alternative="two.sided",
iseed=1L, no_repeat_in_row=FALSE)
a data.frame
containing two columns Ib
and p_sim
containing the local bivariate Moran's I and simulated p-values respectively.
a numeric vector of same length as y
.
a numeric vector of same length as x
.
a listw object for example as created by nb2listw()
.
the number of simulations to run.
default TRUE
.
a character string specifying the alternative hypothesis, must be one of "greater" (default), "two.sided", or "less".
default NULL, used to set the seed for possible parallel RNGs.
default FALSE
, if TRUE
, sample conditionally in each row without replacements to avoid duplicate values, https://github.com/r-spatial/spdep/issues/124
Josiah Parry josiah.parry@gmail.com
The Bivariate Local Moran, like its global counterpart, evaluates the value
of x at observation i with its spatial neighbors' value of y. The value of
Anselin, Luc, Ibnu Syabri, and Oleg Smirnov. 2002. “Visualizing Multivariate Spatial Correlation with Dynamically Linked Windows.” In New Tools for Spatial Data Analysis: Proceedings of the Specialist Meeting, edited by Luc Anselin and Sergio Rey. University of California, Santa Barbara: Center for Spatially Integrated Social Science (CSISS).
# load columbus data
columbus <- st_read(system.file("shapes/columbus.shp", package="spData"))
nb <- poly2nb(columbus)
listw <- nb2listw(nb)
set.seed(1)
(res <- localmoran_bv(columbus$CRIME, columbus$INC, listw, nsim = 499))
Run the code above in your browser using DataLab