Kenv.label {splancs} | R Documentation |
Compute envelope of K1hat-K2hat from random labelling of two point patterns
Kenv.label(pts1,pts2,poly,nsim,s,quiet=F)
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. |
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: http://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), bbox(as.points(okpoly)), seq(5,80,5)) K2.hat <- khat(as.points(okblack), 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), bbox(as.points(okpoly)), nsim=29, s=seq(5,80,5)) lines(seq(5,80,5), env.lab$upper, lty=2) lines(seq(5,80,5), env.lab$lower, lty=2)