Kenv.tor.Rd
Compute envelope of K12hat from random toroidal shifts of two point patterns.
Kenv.tor(pts1,pts2,poly,nsim,s,quiet=FALSE)
First point data set.
Second point data set.
Polygon containing the points.
Number of random toroidal shifts 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 second point data set is randomly shifted using rtor.shift
in the rectangle defined by poly
. Then k12hat
is called
to compute K12hat for the two patterns.
The upper and lower values of K12hat over the ntor
toroidal shifts are 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))
plot(seq(5,80,5), sqrt(k12hat(as.points(okwhite), as.points(okblack),
bboxx(bbox(as.points(okpoly))), seq(5,80,5))/pi) - seq(5,80,5), xlab="distance",
ylab=expression(hat(L)[12]), ylim=c(-35,35), type="l",
main="Simulation envelopes, random toroidal shifts")
env.ok <- Kenv.tor(as.points(okwhite), as.points(okblack),
bboxx(bbox(as.points(okpoly))), nsim=29, s=seq(5,80,5))
#> Doing shift 1 / 29
#> Doing shift 2 / 29
#> Doing shift 3 / 29
#> Doing shift 4 / 29
#> Doing shift 5 / 29
#> Doing shift 6 / 29
#> Doing shift 7 / 29
#> Doing shift 8 / 29
#> Doing shift 9 / 29
#> Doing shift 10 / 29
#> Doing shift 11 / 29
#> Doing shift 12 / 29
#> Doing shift 13 / 29
#> Doing shift 14 / 29
#> Doing shift 15 / 29
#> Doing shift 16 / 29
#> Doing shift 17 / 29
#> Doing shift 18 / 29
#> Doing shift 19 / 29
#> Doing shift 20 / 29
#> Doing shift 21 / 29
#> Doing shift 22 / 29
#> Doing shift 23 / 29
#> Doing shift 24 / 29
#> Doing shift 25 / 29
#> Doing shift 26 / 29
#> Doing shift 27 / 29
#> Doing shift 28 / 29
#> Doing shift 29 / 29
lines(seq(5,80,5), sqrt(env.ok$upper/pi)-seq(5,80,5), lty=2)
lines(seq(5,80,5), sqrt(env.ok$lower/pi)-seq(5,80,5), lty=2)