[R] envelope in spatstat

T.O. Richardson Tom.Richardson at bristol.ac.uk
Wed Apr 14 17:56:55 CEST 2010


Hi R users,

This query is regarding the use of the 'envelope' function in Spatstat.

My data can be represented as a point process with CONTINUOUS marks:

points <- ppp(x=x,y=y, marks=m, window= wind)

However the marks are alignments (lines), and so have to be treated 
differently to normal scalar marks. Hence to create a mcf object with the 
appropriate test function for alignment marks, I input 'func' (below) 
suggested by Stoyan & Penttinen (1989):

func <- function(m1,m2) { sin(abs(m1-m2))^2}	  		
mcf <- markcorr(points, func, normalise = TRUE, method="density")		

So far, so good. However, usinf 'envelope' and 'rlabel' I would like to 
check if the pattern in the data is  lost when randomly relabeling the mark 
for each point. If the test function, 'func' were the usual G(m1,m2)=m1*m2, 
then the following would work:

E <- envelope(points,  markcorr, nsim=20, 
simulate=expression(rlabel(points)))

Howeve, in the above 'markcorr' calculates  G(m1,m2)=m1*m2  by default. So 
need to specify the test function to be G(m1,m2)= sin(abs(m1-m2))^2.

According to the spatstat manual (p177), I may need to 'cook up' a specific 
function, like this:

Kdif = function(X, ..., i) {
  Kidot = Kdot(X, ..., i = i)
  K = Kest(X, ...)
  dif = eval.fv(Kidot - K)
  return(dif)
}
E = envelope(lansing, Kdif, i='blackoak', 
simulate=expression(rlabel(lansing)))


So how do I tell 'envelope' that I want to specify the mark correlation 
test function ??


Many thanks in advance!
T






-----------------------------------------------
Dept. of Maths and Stats, UWE and Ant Lab, Bristol

Room B79.
SoBS, Woodland Rd. BS8 1UG.
+44 (0)117 928 8443



More information about the R-help mailing list