[R-sig-Geo] Kcross and envelope

Brigitte Hogan brigittehogan at gmail.com
Tue Mar 5 01:18:06 CET 2013


Hi All,

I have run into an unexpected outcome using Kcross() and envelope()
that  I hope someone can explain.  My question is, why does envelope()
produce different curves when no edge correction is specified and when
correction is set as "none"? I would expect these curves to be closely
the same, if not identical. For example:

library(spatstat)
data(lansing)
x <- lansing
Kx.en1 <- envelope(unique(x), fun=Kcross, nsim=99, nrank=2)
Kx.en2 <- envelope(unique(x), fun=Kcross, nsim=99, nrank=2, correction="none")
par(mfrow=c(1,2))
plot(Kx.en1)
plot(Kx.en2)

I am also puzzled why the red theoretical line leaves the envelope in
the second plot. I thought that the hi and lo values always bound the
theoretical. The help file (?envelope) does not give a default for
'correction', but says a border correction can be passed to the
function fun using ... . That makes me think there is no 'default' for
border correction in envelope - am I  mistaken?

A related question is why using envelope to calculate Kcross does not
give the same result for the 'obs' line as using a simple Kcross with
'correction="none"'.

Kx.data <- Kcross(x, correction=c("none", "border"))
Kx.en <- envelope(x, fun=Kcross, nrank=2, nsim=99)
par(mfrow=c(1,1))
plot(Kx.en, legend=NULL, main="")
plot(Kx.data, cbind(border,un)~r, col=c("blue","black"), lty=c(1,1),
	lwd=2, legend=TRUE, legendmath=FALSE, add=TRUE)

With these two plots. I was expecting the 'un' line in the second plot
(thick black line) to be the same as the 'obs' line in the first (thin
black line).

Thank you in advance for the help.


Brigitte



More information about the R-sig-Geo mailing list