# Re: [R] Permutation test of marked point pattern

From: Patrick Burns <pburns_at_pburns.seanet.com>
Date: Fri 05 May 2006 - 18:44:25 EST

For completeness of the archives, this problem seems to have been solved via a private conversation.

From my perspective the problem was trying to complicate a situation that was essentially solved. Instead of trying to comprehend how to conform the present situation to someone's implementation of a permutation test, it is much easier to just do the computation. Something like:

permvec <- numeric(1000)
for(i in 1:1000) permvec[i] <- statistic.from.permuted.data p.value <- mean(permvec <= original.statistic)

I think the same is true of bootstrapping. This is more controversial since there are some techniques -- such as bias correction -- with bootstrapping that can improve the results. However, virtually always in the work that I do a naive bootstrap is good enough.

Patrick Burns
patrick@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Jean-Francois Savard wrote:

>Dear R users,
>
>I am trying to perform a hypothesis test on a marked point pattern. I
>would like to calculate the mean of the absolute value of the
>difference of marks between nearest neigbours, randomize the marks
>among points, then calculate this mean again. Ideally, I would test
>whether random mean values smaller than the observed mean value occur
>less than 5% of the time. I suppose 1000 permutations would be a
>reasonable starting point (the ppp object has 27 points).
>
>so far, I've figured out how to:
>
>-create a marked ppp object: ms.ppp
>
>-calculate my test statistic:
>teststat <- mean(abs(markstat(ms.ppp, diff, N=2)))
>
>-randomly allocate marks to a point pattern:
>Y <- rlabel (ms.ppp, labels=ms.ppp\$marks, permute=TRUE)
>
>I have looked at perm.test{exactRankTests} and perused the R help
>archive but haven't been able to find how to work the permutation test
>with a marked ppp object.
>
>I thank you in advance for any help,
>
>
>J-F Savard
>Doctoral Candidate
>University of Maryland
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>
>
>
>

R-help@stat.math.ethz.ch mailing list