Puion
Puion

Reputation: 3

How to interpret the different results of pcfcross, markconnection and markcorrelation function?

I want analyze the spatial correlation between different life history stages of different tree species. I used three different summary statistics, namely, pcfcross, markconnect and markcorr functions. The results are different from each other. The longleaf pine data was used in the example. According to marks values, the longleaf pine trees were divided into different life stages: sapling, juvenile and adult trees. The spatial association of different life stages were analyzed using pcfcross function, and I expected the similar tendency with other functions. However, the results are different from each other. Even, the results of markconnec and markcorr functions are contrasting. Please teach me if there are some errors in my code and how to interpret the results. Thanks in advance.

```
library(spatstat)
### dividing longleaf pine data points into three life stages according to marks
LLsapling <- subset(longleaf, marks<=10)
LLjuvenile <- subset(longleaf, marks>10 & marks <30)
LLadult <- subset(longleaf, marks>30)
marks(LLsapling) <- "LLs"
marks(LLjuvenile) <- "LLj"
marks(LLadult) <- "LLa"
LLall <- superimpose(LLsapling, LLjuvenile, LLadult)
LLas <- superimpose(LLadult, LLsapling)
LLaj <- superimpose(LLadult, LLjuvenile)
LLjs <- superimpose(LLjuvenile, LLsapling)
marks(LLall) <- as.factor(marks(LLall))
marks(LLas) <- as.factor(marks(LLas))
marks(LLaj) <- as.factor(marks(LLaj))
marks(LLjs) <- as.factor(marks(LLjs))
###pcfcross function between different two age stages
par(mfrow=c(1,3))
LLpcf <- plot(envelope(LLall, fun=pcfcross, i="LLa" , j="LLs", correction="best",nsim=199, nrank=5, savepatterns = T), main="pcfcross adult vs sapling")
LLpcf <- plot(envelope(LLall, fun=pcfcross, i="LLa" , j="LLj", correction="best",nsim=199, nrank=5, savepatterns = T), main="pcfcross adult vs juvenile")
LLpcf <- plot(envelope(LLall, fun=pcfcross, i="LLj" , j="LLs", correction="best",nsim=199, nrank=5, savepatterns = T), main="pcfcross juvenile vs sapling")
### markconnection function
par(mfrow=c(1,3))
LLasmkcon <- plot(envelope(LLas, fun=markconnect, i="LLa", j="LLs", correction="best",nsim=199, nrank=5), main="markconnection adult vs sapling")
LLajmkcon <- plot(envelope(LLaj, fun=markconnect, i="LLa", j="LLj", correction="best",nsim=199, nrank=5), main="markconnection adult vs juvenile")
LLjsmkcon <- plot(envelope(LLjs, fun=markconnect, i="LLj", j="LLs", correction="best",nsim=199, nrank=5), main="markconnection juvenile vs sapling")
### markcorrelation fucntion
par(mfrow=c(1,3))
LLasmkcor <- plot(envelope(LLas, fun=markcorr, f=function(m1,m2){m1==m2}, correction="best",nsim=199, nrank=5, 
                        simulate=expression(rlabel(LLas)), savefuns = TRUE, savepatterns = T, kernel="epanechnikov"), main="markcorrelation adult vs sapling")
LLajmkcor <- plot(envelope(LLaj, fun=markcorr, f=function(m1,m2){m1==m2}, correction="best",nsim=199, nrank=5, 
                        simulate=expression(rlabel(LLaj)), savefuns = TRUE, savepatterns = T, kernel="epanechnikov"), main="markcorrelation adult vs juvenile")
LLjsmkcor <- plot(envelope(LLjs, fun=markcorr, f=function(m1,m2){m1==m2}, correction="best",nsim=199, nrank=5, 
                        simulate=expression(rlabel(LLjs)), savefuns = TRUE, savepatterns = T, kernel="epanechnikov"), main="markcorrelation juvenile vs sapling")
dev.off()
```

pcfcross function result markconnect function result

markcorr function result

Y <- cut(longleaf, breaks=c(0, 10, 30, Inf), labels=c("Sapling", "Juvenile", "Adult"))
###pcfcross.inhom function between different two age stages
par(mfrow=c(1,3))
ASpcf <- plot(envelope(Y, fun=pcfcross.inhom, i="Adult" , j="Sapling", correction="best",nsim=199, nrank=5, savepatterns = T), main="pcfcross.inhom Adult vs Sapling")
AJpcf <- plot(envelope(Y, fun=pcfcross.inhom, i="Adult" , j="Juvenile", correction="best",nsim=199, nrank=5, savepatterns = T), main="pcfcross.inhom Adult vs Juvenile")
JSpcf <- plot(envelope(Y, fun=pcfcross.inhom, i="Juvenile" , j="Sapling", correction="best",nsim=199, nrank=5, savepatterns = T), main="pcfcross.inhom Juvenile vs Sapling")
### markconnection function
par(mfrow=c(1,3))
ASmkcon <- plot(envelope(Y, fun=markconnect, i="Adult" , j="Sapling", correction="best",nsim=199, nrank=5, normalise = T), main="markconnection Adult vs Sapling")
AJmkcon <- plot(envelope(Y, fun=markconnect, i="Adult" , j="Juvenile", correction="best",nsim=199, nrank=5, normalise = T), main="markconnection Adult vs Juvenile")
JSmkcon <- plot(envelope(Y, fun=markconnect, i="Juvenile" , j="Sapling", correction="best",nsim=199, nrank=5, normalise = T), main="markconnection Juvenile vs Sapling")

Y pcfcross.inhom Y markconnect

Dr. Adrian Baddeley, thank you very much for your kind explanation. I made some changes to my previous code, and the results are as two figures added above (Y pcfcross.inhom, Y markconnect). I have three questions:

first, the first two panels of these results match well, but the third one (juvenile vs sapling) is different with each other. How can I explain this?

second, I am not clear how to write mark correlation function code for multitype point pattern (with more than three types) without constructing new patterns consisting of two types. If I want apply random labeling to sapling, for example, I should make ppp object for sapling to run simulate=expression(rlabel(sapling)).

third, if there are two species in the above example, and I want to explore the spatial association between different life stages of these two species. Is the following code correct? I really appreciate your help, Thank you!

X <- cut(Xpattern, breaks=c(0, 10, 30, Inf), labels=c("XSapling", "XJuvenile", "XAdult"))
Y <- cut(Ypattern, breaks=c(0, 10, 30, Inf), labels=c("YSapling", "YJuvenile", "YAdult"))
XY <- superimpose(X, Y)
### pcfcross.inhom function   
par(mfrow=c(1,3))
    pcf1 <- plot(envelope(XY, fun=pcfcross.inhom, i="XAdult" , j="YJuvenile", correction="best",nsim=199, nrank=5, savepatterns = T))
    pcf2 <- plot(envelope(XY, fun=pcfcross.inhom, i="XAdult" , j="YSapling", correction="best",nsim=199, nrank=5, savepatterns = T))
    pcf3 <- plot(envelope(XY, fun=pcfcross.inhom, i="XJuvenile" , j="YAdult", correction="best",nsim=199, nrank=5, savepatterns = T))
    pcf4 <- plot(envelope(XY, fun=pcfcross.inhom, i="Xjuvenile" , j="YSapling", correction="best",nsim=199, nrank=5, savepatterns = T))
    pcf5 <- plot(envelope(XY, fun=pcfcross.inhom, i="XSapling" , j="YAdult", correction="best",nsim=199, nrank=5, savepatterns = T))
    pcf6 <- plot(envelope(XY, fun=pcfcross.inhom, i="XSapling" , j="YJuvenile", correction="best",nsim=199, nrank=5, savepatterns = T))  

Upvotes: 0

Views: 223

Answers (1)

Adrian Baddeley
Adrian Baddeley

Reputation: 2973

The results are different because the three functions are measuring different things. The interpretation of these results is further complicated by the fact that they were not all computed from the same dataset.

The pair correlation function gives (effectively) the probability that there will be two points of the pattern at two specified locations, separated by a specified distance r, normalised by dividing by the corresponding probability for a completely random process. For example the graph of pcfcross from adults to saplings lies well below 1, suggesting that saplings are rarely encountered near an adult tree. However the calculation assumes that the point process is stationary (homogeneous). This is not true for the Lansing Woods data, so the results of pcfcross could be misleading (it would have been better to use pcfcross.inhom).

The mark connection function gives the conditional probability, given that there are two points of the pattern at specified locations separated by a distance r, that the first point will belong to type i and the second point will belong to type j. (If normalise=TRUE then this number is divided by the corresponding probability of the same event if the type labels were randomly allocated to the points. The default is normalise=FALSE). This is conceptually different from the pair correlation. The graph of markconnect from adults to saplings suggests that, given we observe two trees separated by a short distance r, it is relatively unlikely that one of them is an adult and the other is a sapling.

The mark correlation function (for a multitype point process) gives the conditional probability, given that there are two points of the pattern at specified locations separated by a distance r, that the two points will belong to the same type. The interpretation of your results here is complicated because you have constructed new point patterns containing only two of the types. The first panel shows the estimated mark correlation function of the point pattern that contains only adults and saplings. This takes large values when the distance r is small, which means that if two trees (selected from amongst the adults and saplings only) are observed to lie a distance r apart, then they are relatively very likely to be of the same type: either two adults, or two saplings.

In conclusion, these results are quite consistent with each other. They suggest that adults and saplings are segregated, which is clear from a plot of the original data.

Finally, a tip: to discretise the marks, use cut.ppp, a method for the generic cut:

Y <- cut(longleaf, breaks=c(0, 10, 30, Inf), labels=c("Sapling", "Juvenile", "Adult"))

Upvotes: 0

Related Questions