[R-sig-Geo] Marked PPA, 'rlabel' function in spatstat

Robin W Hunnewell rhunne at mac.com
Mon Nov 28 05:30:33 CET 2011


Dear all,

I'd like to evaluate a null hypo of 'conditional independence' on a marked point pattern dataset. In scenario of random labelling: given the point locations, marks attached to points are conditionally independent and identically distributed. Marks can be randomly reshuffled among the full set of available points making up the overall pattern. 

To test this, I want to use the 'rlabel' function in spatstat -- which performs a resampling operation, allowing you to hold the point locations fixed and shuffle the marks, e.g., by randomly permuting them among all points in the pattern. 

In 'Analyzing Spatial Pt Patterns in R' (2010) there's an example of how to set up a test statistic for this, but for the life of me can't seem to reproduce it. 

The ASPP in R example suggests a nice way to do it by evaluating the difference btw 'JDot' and 'Jest' as follows;
# cook up a little function to evaluate Ji•(r) − J(r):

> Jdif <- function(X, ..., i) {
+ Jidot <- Jdot(X, ..., i = i) 
+ J <- Jest(X, ...) 
+ dif <- eval.fv(Jidot - J) return(dif)
+}

> E <- envelope(amacrine, Jdif, nsim = 39, i = "on", simulate = expression(rlabel(amacrine)))


I tried to modify this to 'Kdot' and 'Kest' for my own multitype point pattern and run the test using 'envelope' as above,

> kdid <- function(X,..., i) {+ Kidot <- Kdot(X,..., i=i) + K <- Kest(X,...) + dif <- eval.fv(Kidot-K) + return(dif)}

# but when I do 'envelope',
> E <- envelope(B10size, kdid, nsim=39, i="mega", simulate = expression(rlabel(B10size)))

# get following error,
Error in get(x, envir = ee) : object 'Kidot' not found


Have I just goofed the syntax and missed something basic about how to functions? 
Thanks if anyone can help out as to where I'm going wrong?

Robin

------------------------------------------
Robin Hunnewell
University of New Brunswick
Fredericton, NB  
Canada 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20111128/c2ed5e68/attachment.html>


More information about the R-sig-Geo mailing list