I'm trying to find statistical test (or procedure) which is able to discover patterns in spatial distribution of points. I sketch the problem by giving the example about position of bird territories and personality of birds.

1. Load this example data (they are completely fabricated). Data consists of geographical coordinates of territories and the level of aggression for each bird.

Example data:

my.data <- data.frame(x_coor, y_coor, aggression)
rbPal <- colorRampPalette(c("blue","red"))
my.data$Col <- rbPal(10)[as.numeric(cut(my.data$aggression,breaks = 10))]
plot(x_coor,y_coor,pch = 20,col = my.data$Col)

2. As you can see in the plot, the territories of low aggressive birds (blue) have tendency to cumulate together, whereas aggressive birds are solitary (red).

I spend a long time by searching for statistical method which could confirm such pattern (in this case clearly visible).

My first try was to correlate distance matrices of aggression of birds and spatial position of territories. Then applying mantel.test for similarity of these two matrices. This however did not work because mantel.test is unable to absorb the information about spatial isolation of clusters of low aggressive territories. It expect, that if low aggressive birds are together, they will be together all in one big cluster (not in four different clusters as visible from the plot). So mantel.test is unable to confirm or disprove the hypothesis about the influence of aggression on spatial distribution of territories.

3. I have notified that four cluster do not know about each other, thanks to long distances among them, so I try different approach.

I made again the distance matrix of all territories...

geo.dist<-dist(cbind(x_coor, y_coor))

...but I keep only distances of nearest neighbours by setting distance threshold (manually to be the 3 distance units)

geo.dist[geo.dist > 3] <- NA

This creates the imaginary circles around each territory and I was able to count the number of neighbours for each one of them.

for (i in 1:ncol(geo.dist))
no.neighbours[i]<-sum(!is.na(geo.dist[ ,i]))-1

And as you can see form this plot...

plot(aggression,no.neighbours,col = my.data$Col, pch=20)

There is clear negative correlation between number of neighbours and aggression.

cor.test(aggression, no.neighbours)

Is it correct to use this steps to confirm (or falsify) this hypothesis? ("Agression of birds influence the position of territories") Does anybody know some more appropriate solution or the name of commonly used test for such problems?

  • 2
    $\begingroup$ I see (I was too hasty and did not realize it was a marked point pattern). Things I have seen before are the estimate the voronoi tessellation of the points, and see the correlation between the areas and the marked values (e.g. more aggresive should have larger territories). A similar approach to what your doing now is to formulate the spatial weights matrix and calculate the spatial correlation (e.g. Moran's I). What you are describing is negative spatial correlation. $\endgroup$ – Andy W Jul 19 '13 at 15:50

Moran's I is able to test if spatial correlation is present in data. In other words, it can answer three kinds of hypotheses:

1: Are points with similar values (birds with similar personality) close to each other?

In this case is p-value<0.05 and Moran.I$observed will be positive number

2: Are points with similar values more distant from each other? (like chess-board pattern, where neighbours have opposite values)

In this case is also p-value<0.05 but Moran.I$observed will be negative number

3: There is random pattern in data (no spatial correlation)

In this case p-value>0.05


# matrix of all distances...
my.dists <- as.matrix(dist(cbind(my.data$x_coor, my.data$y_coor)))
# ...which is inversed...
my.dists.inv <- 1/my.dists
# ...and their diagonals set to "0"
diag(my.dists.inv) <- 0

# than inserted into Moran.I with tested variable
Moran.I(my.data$aggression, my.dists.inv)

Result: Moran's I revealed a positive spatial correlation between points

Many thanks to Andy W


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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