The principle behind Monte Carlo testing is quite straightforward. For example, suppose that Figure 4.1 shows the positions of 24 plants in a square plot of land with sides of length 2 m. The question to be considered is whether the plants are in random positions. To be more specific, the null model to be tested states that each of the plants was equally likely to occur anywhere within the square, independent of all the other plants.

There are many different test statistics that could be used to summarize the data, and there is no reason why more than one should not be used at the same time. These matters are discussed more fully in Chapter 10, but here what will be considered are a set of nearest-neighbor statistics. The first, g1, is the mean of the distances between plants and their nearest neighbors. As there are 24 plants, there will be 24 distances to be averaged. The second statistic, g2, is the mean of the distances between plants and their second nearest neighbors, which is again an average of 24 distances, one for each plant. More generally, the ith statistic to be considered is the mean distance between plants and their ith nearest neighbors, for i from 1 to 10.