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

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

`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. |

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.

A list with two components, called `$upper`

and `$lower`

. Each
component is a vector like `s`

.

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.

`rLabel`

,`ikhat`

1 2 3 4 5 6 7 8 9 10 11 12 | ```
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))
lines(seq(5,80,5), env.lab$upper, lty=2)
lines(seq(5,80,5), env.lab$lower, lty=2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.