powered by
Spatial autocorrelation test based on global moran index.
moran_test(sfj, wt = NULL, alternative = "greater", symmetrize = FALSE)
A list with moran_test class and result stored on the result tibble. Which contains the following information for each variable:
moran_test
result
MoranI
observed value of the Moran coefficient
EI
expected value of Moran's I
VarI
variance of Moran's I (under normality)
ZI
standardized Moran coefficient
PI
p-value of the test statistic
An sf object or can be converted to sf by sf::st_as_sf().
sf
sf::st_as_sf()
(optional) Spatial weight matrix. Must be a matrix class. If wt is not provided, sdsfun will use a first-order queen adjacency binary matrix.
matrix
wt
sdsfun
(optional) Specification of alternative hypothesis as greater (default), lower, or two.sided.
greater
lower
two.sided
(optional) Whether or not to symmetrize the asymmetrical spatial weight matrix wt by: 1/2 * (wt + wt'). Default is FALSE.
FALSE
gzma = sf::read_sf(system.file('extdata/gzma.gpkg',package = 'sdsfun')) moran_test(gzma)
Run the code above in your browser using DataLab