# Mean Nearest Neighbor test vs Nearest Neighbor function envelope test?

I am analyzing a point pattern using G (nearest neighbor cumulative distribution) function, followed up by the envelope tests and in the same time using Nearest Neighbor Index test (Clark Evans test ). For this purpose I use spatstat, guided by "Spatial Point Patterns: Methodology and Applications with R" by Baddeley, Rubak and Turner.

To my surprise the G tests results in non rejection of the H0, while Clark Evans test suggests rejection of the H0. I was wondering if it means that one of the tests for any reason provides false result? or that due to the nature of the tests there is no fallacy in observing such results.

Another question: could Clark Evans test be used to test not only CSR, but other H0?

Thank you!

update:

Here is an example of the spatial pattern

further:

plot(envelope(my_pattren, Gest, correction="none"))

mad.test(my_pf[[33]], Gest)

Monte Carlo test based on 99 simulations
Summary function: G(r)
Reference function: theoretical
Alternative: two.sided
Interval of distance values: [0, 77.6841825602024]
Test statistic: Maximum absolute deviation
Deviation = observed minus theoretical
data:  my_pattern
mad = 0.36677, rank = 19, p-value = 0.19


Clark Evans test

clarkevans.test(my_pattern)

Clark-Evans test
No edge correction
Z-test
data:  my_pattern
R = 1.2298, p-value = 0.03502
alternative hypothesis: two-sided

• There is no fallacy in observing different test results from different tests. It is somewhat surprising that Clark-Evans detects departure from CSR which an envelope test based on G doesn't detect. What kind of envelope test do you perform? Can you share your data and code? Or just the code with artificial data and a bit more details... – Ege Rubak Sep 15 '17 at 10:01
• @EgeRubak Done! – Sp_J Sep 19 '17 at 17:03
• Could you provide the coordinates of your point pattern? Why do you call mad.test on my_pf[33]] and clarkevans.test on my_pattern? Also did you try to add a correction to clarkevans.test? The uncorrected index tends to be positively biased and may lead to spurious results. – Ege Rubak Sep 21 '17 at 8:04

My guess would be that, because the minimum distance between points is ~ 17 units, the average nearest-neighbor distance for the observed pattern may differ from that under CSR (as the pattern depicted above seems to resemble a hard core point process...or something with replusion at short distances). When you add in positive bias associated with edge effects, it may not be all that surprising that you got a significant result from the Clark-Evans test, but not the G-function.

If you want to determine if it is indeed an edge effect that is biasing the result, you could try comparing the Clark-Evans test to the Hopkins-Skellam test, which is less sensitive to edge effects. Likewise, rather than a G-function, you could try a J-function (which could be thought of as the continuous analog of the Hopkins-Skellam test).

A couple other things to consider:

1) The G-function is cumulative, so the effect of repulsion at shorter distances starts to diminish with increasing distance.

2) Your number of sample points is somewhat small relative to the size of the sampling area, so you may not have high power to detect a departure from CSR via the G-function (note that the significance envelope is somewhat large and jagged).

The Clark-Evans test is specific to nearest-neighbor distances, but other indices do exist (as noted above). However, these sorts of tests were developed when it was more difficult to map (and analyze) point patterns and they are now considered to be somewhat crude, especially since they reduce the pattern to a single index.

You might be able to get some better advice as to how to proceed if you were to provide a bit more information about your study system and the scientific hypothesis you are trying to test. For example, if you really are dealing with something like a hard core process, then a test such as Clark-Evans might be flawed (since CSR would not be a sensible null).

• Thank you very much for you reply! I have tried Hopskin - Skellam test, the result of the test supports results of the MAD test for G function. True, I have premises to consider a hard core process and I would like to test the the patter against HC hypotheses as well. Could it be done be means of Clark Evans or Hopskin - Skellam tests, in principle? – Sp_J Sep 23 '17 at 14:51
• Both Clark Evans and Hopskins-Skellam compare the observed pattern to that expected under CSR. I am not aware of an analog for a Gibbs process...and I am not sure that you would want an index since the goal is often to understand the nature and range of the interaction between points. Again, it partly depends on what it is that you are trying to test. – coreydevinanderson Sep 24 '17 at 14:29
• So would it be possible to use the Clark Evans and just make standardization of Z value using SE that one gets from the patterns that were simulated using the null hypotheses? – Sp_J Sep 28 '17 at 12:00
• It is CSR that is used as the dividing hypothesis. For example, if you can reject CSR (and it is not due to some sort of unaccounted for bias)...and something like Clark-Evans suggests regularity, then you are justified in exploring other models that may be more suitable. Part of the reason why you would fit a Gibbs model is to estimate the nature of the interaction and the distance; picking (or fitting) one parameterization of a Gibbs model as the null and rejecting it would just imply that the model did not fit well. It would not serve as a dividing hypothesis like CSR. – coreydevinanderson Sep 28 '17 at 15:12
• I will note again, that you if want to know the next best step, then you have to provide more information about the nature of your study system and the hypothesis you are trying to test. Even theoretical questions need a context. – coreydevinanderson Sep 28 '17 at 15:17