I have a spatial point pattern that I would like to test against complete spatial randomness. I managed to plot a Ripley's K function for my data and a function for a random distribution with a confidence envelope. From this I can infer whether or not my data deviates from spatial randomness.

However, I wonder whether it is possible to statistically test these two functions against one another (and thus get a p-value that indicates the deviation from a random distribution)?

2 Answers 2


Getting a p value is not that easy. Marcon and Lang (Testing randomness of spatial point patterns with the Ripley statistic, http://arxiv.org/abs/1006.1567) have demonstrated that (K1, K2..Kn) where K1, K2..Kn are the values of the Ripley s K function at different distances is a Gaussian vector. They have then computed its mean and covarianace matrix in the square and used a chi 2 test for spatial randomness. You can use the same idea by computing empirically (with Monte-Carlo simulations) the mean/covariance matrix in your domain. Regards Thibault Lagache


I expect you've got something like this pic, and you are trying to find the difference between the OBServed and THEOretical. It's tempting to think we could compute the differences between the two curves, and get a p-value...but there is no table to look it up on. Ripley's K is a descriptive statistic, not an inferential one.

The envelope function (?envelope) provides some useful relevant information, as does typing summary(dataset.ppp).

The simultaneous critical envelopes allow us to perform a different Monte Carlo test (Ripley, 1981). The test rejects the null hypothesis if the graph of the observed function lies outside the envelope at any value of r. This test has exact significance level alpha = nrank/(1 + nsim).

The pointwise envelopes are not “confidence bands” for the true value of the function! Rather, they specify the critical points for a Monte Carlo test (Ripley, 1981).

enter image description here

Your Answer

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

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