# Spatial correlation of white noise is close to zero
rmat <- matrix(runif(1000) > .5, ncol = 100)
raw_moran(rmat)
# Spatial correlation of a half-ones / half-zeros matrix is close to one.
# This would produce close but inaccurate results in version <3.0.2
m <- cbind(matrix(1, nrow = 100, ncol = 50),
matrix(0, nrow = 100, ncol = 50))
raw_moran(m)
Run the code above in your browser using DataLab