Plots a set of values against their spatially lagged values and gives the Moran coefficient as a measure of spatial autocorrelation.
moran_plot( x, w, xlab = "x (centered)", ylab = "Spatial Lag", pch = 20, col = "darkred", size = 2, alpha = 1, lwd = 0.5, na.rm = FALSE )
Anselin, Luc. "Local indicators of spatial association—LISA." Geographical analysis 27, no. 2 (1995): 93-115.
A numeric vector of length n.
An n x n spatial connectivity matrix.
Label for the x-axis.
Label for the y-axis.
Width of the regression line.
na.rm = TRUE, any observations of
NA values will be dropped from
x and from
gg plot, a scatter plot with
x on the horizontal and its spatially lagged values on the vertical axis (i.e. a Moran scatter plot).
For details on the symbol parameters see the documentation for geom_point.
If any observations with no neighbors are found (i.e.
any(Matrix::rowSums(w) == 0)) they will be dropped automatically and a message will print stating how many were dropped.