Compute envelope of K1hat-K2hat from random labelling of two point patterns

Kenv.label(pts1,pts2,poly,nsim,s,quiet=FALSE)

Arguments

pts1

First point data set.

pts2

Second point data set.

poly

Polygon containing the points.

nsim

Number of random labellings to do.

s

Vector of distances at which to calculate the envelope.

quiet

If FALSE, print a message after every simulation for progress monitoring. If TRUE, print no messages.

Value

A list with two components, called $upper and $lower. Each component is a vector like s.

Details

The two point data sets are randomly labelled using rLabel, then Khat is called to estimate the K-function for each resulting set at the distances in s. The difference between these two estimates is then calculated. The maximum and minimum values of this difference at each distance,over the nlab labellings is returned.

See also

References

Rowlingson, B. and Diggle, P. 1993 Splancs: spatial point pattern analysis code in S-Plus. Computers and Geosciences, 19, 627-655; the original sources can be accessed at: https://www.maths.lancs.ac.uk/~rowlings/Splancs/. See also Bivand, R. and Gebhardt, A. 2000 Implementing functions for spatial statistical analysis using the R language. Journal of Geographical Systems, 2, 307-317.

Examples

data(okwhite)
data(okblack)
okpoly <- list(x=c(okwhite$x, okblack$x), y=c(okwhite$y, okblack$y))
K1.hat <- khat(as.points(okwhite), bboxx(bbox(as.points(okpoly))), seq(5,80,5))
K2.hat <- khat(as.points(okblack), bboxx(bbox(as.points(okpoly))), seq(5,80,5))
K.diff <- K1.hat-K2.hat
plot(seq(5,80,5), K.diff, xlab="distance", ylab=expression(hat(K)[1]-hat(K)[2]), 
ylim=c(-11000,7000), type="l", main="Simulation envelopes, random labelling")
env.lab <- Kenv.label(as.points(okwhite), as.points(okblack), 
bboxx(bbox(as.points(okpoly))), nsim=29, s=seq(5,80,5))
#> Doing labelling  1 / 29 
#> Doing labelling  2 / 29 
#> Doing labelling  3 / 29 
#> Doing labelling  4 / 29 
#> Doing labelling  5 / 29 
#> Doing labelling  6 / 29 
#> Doing labelling  7 / 29 
#> Doing labelling  8 / 29 
#> Doing labelling  9 / 29 
#> Doing labelling  10 / 29 
#> Doing labelling  11 / 29 
#> Doing labelling  12 / 29 
#> Doing labelling  13 / 29 
#> Doing labelling  14 / 29 
#> Doing labelling  15 / 29 
#> Doing labelling  16 / 29 
#> Doing labelling  17 / 29 
#> Doing labelling  18 / 29 
#> Doing labelling  19 / 29 
#> Doing labelling  20 / 29 
#> Doing labelling  21 / 29 
#> Doing labelling  22 / 29 
#> Doing labelling  23 / 29 
#> Doing labelling  24 / 29 
#> Doing labelling  25 / 29 
#> Doing labelling  26 / 29 
#> Doing labelling  27 / 29 
#> Doing labelling  28 / 29 
#> Doing labelling  29 / 29 
lines(seq(5,80,5), env.lab$upper, lty=2)
lines(seq(5,80,5), env.lab$lower, lty=2)