Kenv.label.Rd
Compute envelope of K1hat-K2hat from random labelling of two point patterns
Kenv.label(pts1,pts2,poly,nsim,s,quiet=FALSE)
First point data set.
Second point data set.
Polygon containing the points.
Number of random labellings to do.
Vector of distances at which to calculate the envelope.
If FALSE, print a message after every simulation for progress monitoring. If TRUE, print no messages.
A list with two components, called $upper
and $lower
. Each
component is a vector like s
.
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.
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.
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)