0
votes

I have two observed point patterns on a network: obs1 and obs2. These points are observed and noted into field measurement book. Some points among these (say s) are always found at the same location. That is s is common to both obs1 and obs2. I want to exclude this set s from the point pattern before I calculate the intensity or any other process.

Is there a way(command/function) to compare two point processes and remove the common points between them?

1

1 Answers

0
votes


Best thing I can think of right now is to compute nearest neighbours across the two patterns like below.

Artificial dataset where points 2 and 3 of X correspond to points 1 and 2 of Y:

library(spatstat)
X <- unmark(chicago)[1:3]
Y <- unmark(chicago)[2:5]
plot(X, chars = 24, cols = "blue")
plot(Y, cex = 1.5, cols = "red", add = TRUE)

Cross distances:

d <- nncross(X, Y, what = c("dist", "which"))

Id in X of points with very close neighbour in Y:

whichX <- which(d$dist <= .Machine$double.eps)

Corresponding points in Y:

whichY <- d$which[whichX]

Resulting plot:

Xnew <- X[-whichX]
Ynew <- Y[-whichY]
plot(Xnew, chars = 24, cols = "blue")
plot(Ynew, cex = 1.5, cols = "red", add = TRUE)