Is wikipedia wrong...or I don't understand it?

Wikipedia: The white and black squares ("chess pattern") are perfectly dispersed so Moran's I would be −1. If the white squares were stacked to one half of the board and the black squares to the other, Moran's I would be close to +1. A random arrangement of square colors would give Moran's I a value that is close to 0.

# Example data:
x_coor<-rep(c(1:8), each=8)
y_coor<-rep(c(1:8), length=64)
my.values<-rep(c(1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1), length=64)
rbPal <- colorRampPalette(c("darkorchid","darkorange"))
my.Col <- rbPal(10)[as.numeric(cut(my.values,breaks = 10))]

# plot the point pattern...
plot(y_coor,x_coor,col = my.Col, pch=20, cex=8, xlim=c(0,9),ylim=c(0,9))

So as you can see points are perfectly dispersed

# Distance matrix
my.dists <- as.matrix(dist(cbind(x_coor,y_coor)))
# ...inversed distance matrix
my.dists.inv <- 1/my.dists
# diagonals are "0"
diag(my.dists.inv) <- 0

Moran's I computation library(ape)

Moran.I(my.values, my.dists.inv)
[1] -0.07775248

[1] -0.01587302

[1] 0.01499786

[1] 3.693094e-05

Why I get observed = -0.07775248 instead of "-1".

up vote 7 down vote accepted

Wikipedia, specifically's_I as I write, is very wrong on this point.

Although $I$ is a measure of autocorrelation, it is not an exact analogue of any correlation coefficient bounded by $-1$ and $1$. The bounds, unfortunately, are much more complicated.

For a much more careful analysis, see

de Jong, P., Sprenger, C., van Veen, F. 1984. On extreme Values of Moran's $I$ and Geary's $c$. Geographical Analysis 16: 17-24.

I haven't tried to check your calculation.

When using Queens contiguity based spatial weights matrix, that is neighbors are only considered to be away by a distance of 1 (and not the same color on the diagonals $\sqrt{2}$ distance away) you get the observed value of Moran's I to be $-1$.

my.dists.bin <- (my.dists == 1)
diag(my.dists.bin) <- 0

Moran.I(my.values, my.dists.bin)

Here is your original image so people understand what I am talking about. This construction makes it so only orange are neighbors to purple and vice versa only purple are neighbors of orange.

Checkerboard Map

I would be impressed if you could concoct a perfect negative auto-correlation with an inverse distance weighted matrix, even with the bounds listed in the citation in Nick Cox's answer. Much of the theory used by economists uses binary contiguity matrices that are row standardized to develop distributions (see Local indicators of spatial association-LISA (Anselin, 1995) from the same Geographical Analysis journal). So in short, many of the results are only proven for particular forms of a weights matrix, which don't tend to be exactly portable for inverse distance weighted (or more exotic) spatial weights matrices.

  • Given that the expected value reported by the ape library is $-1/(N-1)$ (see a recent question on the GIS site), I suspect they are converting the weights matrix to be row standardized under the hood, (or just mis-reporting the expected value). This is only the expected value in the case the spatial weights matrix sums to 1. – Andy W Jun 2 '14 at 16:14

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.