raw_moran | R Documentation |
This function computes the Moran's I index of spatial correlation at lag 1.
raw_moran(mat)
mat |
A matrix containing logical, numeric or integer values |
This function returns the spatial correlation as measured by
the Moran's I index. If the variance of the matrix is zero, then
NaN
is returned. This function assumes a 4-way neighborhood (a.k.a.
von-Neumann neighborhood), and does not wrap around at the sides of the matrix.
The Moran's I numeric value as a numeric number.
generic_sews
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.