image thumbnail

Moran's I

version (2.53 KB) by Felix Hebeler
Calculates local Moran's I index of spatial correlation for raster.


Updated 31 Mar 2016

View License

PURPOSE: calculate local Moran's I for a local grid using a weight matrix.
USAGE: m = moransI(grid, W, s);
where: [grid] is the matrix to analyze
[W] is the normalized weight matrix of the size the local Moran's I will be calculated for
[s] is an optional flag to use zscores of input values for calculation. Set to 'true' if zscores of local grid should be calculated. Leave blank if not desired or input values are already standardized. -------------------------------------------------------------------------
[m] Moran's I of input raster weighted using [W]
NOTES: Weight matrix needs to be 'moving window' style, not contiguity matrix: Moran's I is calculated and weighted for neighbours to center cell. Matrix needs to be normalized (weights sum to 1) and center cell weight will be set to 0 if not already.
See Anselin (1995, 'LISA.', Geogr. Analysis 27(2),p.93f) for details on standardized variables in calculation of local Moran's I.

Cite As

Felix Hebeler (2021). Moran's I (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!