0
votes

This question is very close to what has been asked here. The answer is great if we want to generate random marks to an already existing point pattern - we draw from a multivariate normal distribution and associate with each point.

However, I need to generate marks that follows the marks given in the lansing dataset that comes with spatstat for my own point pattern. In other words, I have a point pattern without marks and I want to simulate marks with a definite pattern (for example, to illustrate the concept of segregation for my own data). How do I make such marks? I understand the number of points could be different between lansing and my data set but I am allowed to reduce the window or create more points. Thanks!

2
I don't quite understand the big difference between this and the question you link to. You say you already have a point pattern and want to simulate marks. This is exactly the same for the linked question. Is the only difference that you want segregation and the other question was about clustering?Ege Rubak
Yes, how do I make sure I will have segregation if I have clustering? Sorry if it is confusing.user2167741
The point of my example answer below is that you have to be more specific about what you want. Do you want 6 patches where only one species lives or do you want 90% of one and 2% of each of the other? Should there be one patch per species or several? Should the patches be big/small? What about the shape of patches? Is it correct that you already have the points and you only want to attach random marks that appear in patches or do you also allow for the points to be generated randomly? Etc. etc.Ege Rubak
Hi Ege, the point is to demonstrate how segregation works and it doesn't matter if the percentages are here and there. Let's say I want 4 patches with 30%, 20%, 10%, 40%, and I want one patch per species. How do I go about in simulating it? It is purely for demo purposes and the shape can be arbitrary like some closed curves - rectangles are easy to generate. Yes, I already have the points and only want the marks. Marks are the only variable that I need to collect in my experiment.user2167741
I forgot to follow up on this. Now there is an alternative answer which you may find more appropriate. It should be straightforward to modify to your needs.Ege Rubak

2 Answers

1
votes


Here is another version of segregation in four different rectangular regions.

library(spatstat)

p <- c(.6,.2,.1,.1)
prob <- rbind(p,
              p[c(4,1:3)],
              p[c(3:4,1:2)],
              p[c(2:4,1)])
X <- unmark(spruces)
labels <- factor(LETTERS[1:4])
subwins <- quadrats(X, 2, 2)
Xsplit <- split(X, subwins)
rslt <- NULL
for(i in seq_along(Xsplit)){
  Y <- Xsplit[[i]]
  marks(Y) <- sample(labels, size = npoints(Y),
                     replace = TRUE, prob = prob[i,])
  rslt <- superimpose(rslt, Y)
}
plot(rslt, main = "", cols = 1:4)
plot(subwins, add = TRUE)

0
votes


Segregation refers to the fact that one species predominates in a specific part of the observation window. An extreme example would be to segregate completely based on e.g. the x-coordinate. This would generate strips of points of different types:

library(spatstat)

X <- lansing
Y <- cut(X, X$x, breaks = 6, labels = LETTERS[1:6])
plot(Y, cols = 1:6)

Without knowing more details about the desired type of segregation it is hard to suggest something more useful.