On page 192 of Analysing spatial point patterns in 'R' (Baddeley 2011), there are plots of the Gcross function for the amacrine dataset. I am looking for an interpretation of the plot. off/off and on/on are far below the CSR line, but on/off and off/on cross the CSR line - what does this mean please?


1 Answer 1


The $G$ and cross-$G$ functions are cumulative distributions of interpoint distances.

Let's take a look at the points in the "amacrine" dataset, plotting each separately, then together, and finally with some uniformly random (independent) points for reference:


It appears that the random points tend to cluster more and have more gaps than either the "On" or "Off" points. This means that the "On" or "Off" points will have relatively few neighbors for very short distances.

On the other hand, the bottom left plot ("All points") suggests "On" and "Off" points are frequently coincident. Does this happen more than one would expect if the two sets of points were independent? Let's look at the $G$ and cross-$G$ functions to help us answer this question:

G and cross-G plots

First, notice that the $G$ functions (in the upper left and lower right corners) confirm what we could see: the distributions of distances fall below the "theoretical" (dotted) lines (which correspond to independent random distributions). Because the height of a $G$ function is a cumulative frequency, this means that the frequencies of short distances among both the "On" and "Off" points are less than would be seen in random sets.

Turn now to interpreting the cross-$G$ function. At extremely small distances, it is below the reference: there aren't quite enough pairs of really close white and black dots in the previous "All points" plot. But soon the cross-$G$ line increases and exceeds the reference: for intermediate to large distances, there are too many pairs of white and black points. We might say that overall there is a positive association between "on" and "off" points but that at short distances there is a slight negative association--a "repulsion," if you will.

My reading of the documentation--which is unclear on this point--is that the "theoretical" line for the cross-$G$ function is computed assuming "On" and "Off" are independently and uniform random ("CSR") and therefore does not reflect their obvious departure from CSR behavior. It would be more useful to know what the cross-$G$ function would look like if both "On" and "Off" points were independent realizations of processes having $G$ functions like those shown here: that would give a more accurate picture of the nature of their mutual association in this dataset. Such a curve could be created through simulation or bootstrapping. (For instance, one could repeatedly shift and rotate the "Off" points at random and compute the new cross-$G$ function with the "On" points, and finally plot the average of all these cross-$G$ functions, after a suitable correction for edge effects.)

R Code

To produce the first figure:


plot(amacrine[amacrine$marks=="on"], chars=1, main="On")    #$ (TeX bug workaround)
plot(amacrine[amacrine$marks=="off"], chars=19, main="Off") #$ (TeX bug workaround)
plot(amacrine, chars=c(1,19), main="All points")
n <- floor(length(amacrine$marks) / 2); w <- amacrine$window
x.random <- runif(n, min=w$xrange[1], max=w$xrange[2])
y.random <- runif(n, min=w$yrange[1], max=w$yrange[2])
plot.owin(w, main="Random points")
points(x.random, y.random, pch=19, col="Gray",
     xaxt="n", xlab="", yaxt="n", ylab="", xlim=w$xrange, ylim=w$yrange)

The second figure:

plot(Gdot(amacrine, "on", correction="km"), lwd=2, col=c("Black", "Red", "Gray"), 
plot(Gcross(amacrine, correction="km"), lwd=2, main="Gcross")
plot(Gcross(amacrine, correction="km"), lwd=2, main="Gcross")
plot(Gdot(amacrine, "off", correction="km"), lwd=2, main="Gdot('off')")
  • 1
    $\begingroup$ Thank you! That's a great answer, finally I've understood! $\endgroup$
    – Sean
    Commented Sep 26, 2012 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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