[R] envelopes of simulations

Adrian Baddeley adrian at maths.uwa.edu.au
Mon Jan 16 05:04:13 CET 2006

Sara Mouro writes:
 > Hello!
 > I am writing you because I could not plot the confidence envelopes for
 > functions Jest, Jcross, Jdot, Jmulti, and L, using the Spatstat package.

Enquiries about a package should be sent to the package maintainer
rather than R-help. 

 > I have already understood how to do that for Kest or Jest, that is:
 > JEnv <- plot(envelope(PPPData, Jest))
 > 	Where PPPData is my ppp object.
 > However, for Jcross I must specify the two marks I want to analyse.
 > That is, usually I would get the Jcross doing:
 > Jc <- Jcross(PPPData,"Aun","Qsu")
 > 	For marks "Aun" and "Qsu".

To do this, type
      envelope(PPPData, Jcross, i="Aun", j="Qsu")

	Looking at help(Jcross) we see that its formal syntax is 
		Jcross(X, i, j). 
	This means that when you call 
	the arguments are matched as 

	So our problem is, how to pass the arguments 	i="Aun" and j="Qsu"
	to the function Jcross each time it is called by `envelope'.

	The help entry for 'envelope' mentions that `envelope' will accept 
	extra arguments "..." which are then passed to the function 'fun'.
	So, to pass the two argument values i="Aun" and j="Qsu",
	just type
	     envelope(PPPData, Jcross, i="Aun", j="Qsu")

 > For L function, I can make:
 > K <- Kest (PPPData, correction="isotropic")
 > plot (K, r-sqrt(iso/pi)~r)

	You can compute the envelope for the K-function
	and transform it afterwards. 

	To plot envelopes of the L function discrepancy
	   LD(r) = sqrt(K(r)/pi) - r,
	just type 
		E <- envelope(PPPData, Kest, correction="isotropic")
		plot(E, sqrt(./pi) -r ~ r)

Hope this helps.
Adrian Baddeley

More information about the R-help mailing list