Raster Local Moran P Value
The cluster and outlier analysis output is a Local Moran's I index value, Z score, p-value, and cluster type code for each feature. This function creates as derived output the names of the index, Z score, p-value, and cluster type result fields. Calculate different statistics of local indicator of spatial association (LISA) for each. This function returns standardized value (Z) for Moran, G and G., and K1 statistics. Longley and M. Batty (eds) Spatial analysis: modelling in a GIS. The first raster layer r.I local Moran's I.
Spatial autocorrelation
Compute Moran's I or Geary's C measures of global spatial autocorrelation in a RasterLayer, or compute the the local Moran or Geary index (Anselin, 1995).
- Keywords
- spatial
Usage
Arguments
RasterLayer
Spatial weights defined by or a rectangular matrix with odd length (3, 5, ...) sides (as in focal
)
Details
The default setting uses a 3x3 neighborhood to compute 'Queen's case' indices. You can use a filter (weights matrix) to do other things, such as 'Rook's case', or different lags.
Value
A single value (Moran's I or Geary's C) or a RasterLayer (Local Moran or Geary values)
References
Raster Local Moran P Value List
Moran, P.A.P., 1950. Notes on continuous stochastic phenomena. Biometrika 37:17-23
Geary, R.C., 1954. The contiguity ratio and statistical mapping. The Incorporated Statistician 5: 115-145
Anselin, L., 1995. Local indicators of spatial association-LISA. Geographical Analysis 27:93-115
See Also
The spdep package for additional and more general approaches for computing indices of spatial autocorrelation
Aliases
- Geary
- Moran
- MoranLocal
- GearyLocal
Examples
library(raster)
# NOT RUN {r <- raster(nrows=10, ncols=10)r[] <- 1:ncell(r)Moran(r)# Rook's casef <- matrix(c(0,1,0,1,0,1,0,1,0), nrow=3)Moran(r, f)Geary(r)x1 <- MoranLocal(r)# Rook's casex2 <- MoranLocal(r, w=f)# }
Community examples
I'm trying to run a spatial autocorrelation (SAC) on light values across a sampling area. I did some searching, and I've found that Moran's I (in the ape package) is a common tool used in R to do SAC. However, I ran the code and I'm not entirely sure if R is doing what I want. The code doesn't break, but I've input my variable (transformed light values) using the Moran.I function:
My distance matrix (ld.dist.mat) is a matrix of distances between all points (A-O) on my grid. It looks like this:
My question is how does R know which points on my grid are associated with each light value? I have tried print(Moran.I)
to figure this out, but I have only been programming since fall of last year (2012) and I am not well versed enough in R to know how to interpret the function. Also, if R isn't identifying my light values in the right way, how do I fix that?
Any help would be greatly appreciated.
Jilber Urbina1 Answer
Pseudo P Value
You can do the following to get the global and local measures of spatial autocorrelation using Moran's measure using the code below:
For Geary's autocorr measure: