# R raster Package Moran's I interpretation

I am using raster package to calculate the local Moran's I . The example gives the range of Moran's I between - 1 to 2.47. On my own data I have see the value range -3.070423 - 7.228558 How can Moran' I value be larger than 1 ? Most of the literature point out the value of global Moran's I is between -1 and 1. What does local Moran's I value larger than 1 mean as implemented by the R raster package?

``````#data
r <- raster(nrows=10, ncols=10)
r[] <- 1:ncell(r)
plot(r)
`````` ``````#local Moran's I
x1 <- MoranLocal(r)
plot(x1)
`````` • Your comment about "most of the literature" may be confusing the global Moran's I (which typically will lie between -1 and 1) and the local values, which can have an arbitrarily wide range (depending on how many raster cells there are). – whuber Jul 22 '14 at 15:28

## 1 Answer

The formula for global Moran's I is: where i is an index of analysis units (basically, measurement units of of your map, or in your case pixels in the raster) and j is an index of the neighbors of each map unit. The formula for local Moran's I is extremely similar, except that since local Moran's I is calculated separately for each analysis unit indexed by i, in the top part of the fraction you don't need to sum over i: Values for and will be distributed around the mean, so, intuitively, over the entire study area high and low clusters will offset each other and global Moran's I will be constrained to lie between -1 and 1. But for local Moran's I, a cluster (high, low, doesn't matter) will be comprised of values where and deviate significantly from the mean, and therefore the top part of the fraction in the second equation will be large in absolute value, much larger than the global deviation from the mean captured in the bottom part of the fraction by .

In your constructed example, you can see this clearly. The top rows are low values, the middle rows are near the mean, and the bottom rows are high values. Therefore, as demonstrated in your second plot, local Moran's I is high in the top and bottom rows, because those rows contain values far from the mean. Local Moran's I is near 0 in the middle rows, because those values are all near the mean. Your example does not show dispersion (the classic checkerboard pattern), so local Moran's I is not negative anywhere.

Let's calculate by hand for one of the pixels. Pixel number 15 has eight neighbors with values 4, 5, 6, 14, 16, 24, 25, 26. So:

``````x = 1:100
Ii = length(x) *
(15 - mean(x)) *
sum(1 * (c(4, 5, 6, 14, 16, 24, 25, 26) - mean(x))) /
sum((x - mean(x))^2)
Ii
#  12.09961
``````

Incidentally, this does not equal the same value for pixel 15 produced by `MoranLocal`:

``````x1
# 1.512451
``````

At first I thought I did something wrong, so I created a vector 10x10 grid in vector format that was an exact analog of the 10x10 raster and ran it through the `localmoran` function in package `spdep`. It turns out that `MoranLocal` is calculating using a row-standardized weights matrix, whereas the formula I included above is based on using a simple binary queen's contiguity matrix. `spdep` gives you control over these options. Using the row-standardized matrix, the are 1/8 (eight neighbors at 1/8 each sum to 1), so:

``````x = 1:100
Ii = length(x) *
(15 - mean(x)) *
sum(0.125 * (c(4, 5, 6, 14, 16, 24, 25, 26) - mean(x))) /
sum((x - mean(x))^2)
Ii
#  1.512451
``````

The original source for local Moran's I is Anselin (1995), "Local Indicators of Spatial Association—LISA" (appears to be open access).