Load Packages/Data
library(spatstat)
data(paracou)
pwindow <- paracou$window
# subset to only juvenile trees
paracou2 <- as.data.frame(paracou) # data frame for easy subsetting
paracou2 <- paracou[which(paracou$marks == "juvenile"),]
plot(paracou2$x,paracou2$y,xlab="X",ylab="Y", main = "Plot of Juvenile Kimboto trees")
# need to get subset data back into a ppp model
paracou3 <- ppp(paracou2$x,paracou2$y, marks=paracou2$marks, window=pwindow)
intens <- intensity(paracou3) # compute intensity
The intensity estimate is 0.0039865. That is, based off of the data, the expected density of juvenile trees is 0.0039865 per square meter.
plot(density(paracou3),main = "Intensity Plot")
points(paracou3,pch=16)
quadrat.test(paracou3,alternative="clustered") # 5 x 5 quadrats
##
## Chi-squared test of CSR using quadrat counts
## Pearson X2 statistic
##
## data: paracou3
## X2 = 135.57, df = 24, p-value < 2.2e-16
## alternative hypothesis: clustered
##
## Quadrats: 5 by 5 grid of tiles
quadrat.test(paracou3,nx=7,ny=7,alternative="clustered")# 7 x 7 quadrats
##
## Chi-squared test of CSR using quadrat counts
## Pearson X2 statistic
##
## data: paracou3
## X2 = 232.87, df = 48, p-value < 2.2e-16
## alternative hypothesis: clustered
##
## Quadrats: 7 by 7 grid of tiles
quadrat.test(paracou3,nx=3,ny=3,alternative="clustered")# 3 x 3 quadrats
##
## Chi-squared test of CSR using quadrat counts
## Pearson X2 statistic
##
## data: paracou3
## X2 = 46.191, df = 8, p-value = 2.186e-07
## alternative hypothesis: clustered
##
## Quadrats: 3 by 3 grid of tiles
For all grid choices, the quadrat test suggests that we can reject the null of complete spatial randomness in favor of the alternate clustered hypothesis (or a two-sided alternate hypothesis, but not regular).
G <- Gest(paracou3)
plot(envelope(paracou3,fun=Gest),main="Estimated & Theoretical G Function & Monte Carlo Envelope",xlab="r(meters)")
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
## 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
## 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
## 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
## 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
## 91, 92, 93, 94, 95, 96, 97, 98, 99.
##
## Done.
K <- Kest(paracou3)
# plot for distances r up to 20 meters since we care about the shorter distances
plot(envelope(paracou3,fun=Kest),xlim=c(0,20), main="Estimated & Theoretical K Function & Monte Carlo Envelope",xlab="r(meters)")
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
## 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
## 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
## 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
## 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
## 91, 92, 93, 94, 95, 96, 97, 98, 99.
##
## Done.
From these tests, we can conclude that there is sufficient evidence that the data do not come from a homogeneous poisson process. This is due to the fact that the empircal G and K functions lie outside (above) the 99% confidence bands under a homogeneous poisson process. We can intrepret the data as having too many small nearest neighbor distances than expected under a homogeneous poisson process.
The pattern of adult trees appearing more regular could suggest that adult trees are repulsive in the sense that they require significant space and resources from the immediate soil around them and don’t want to compete with other adult trees for them. It is plausible then that the observed pattern of juvenile trees cluster around the various adult trees, as they are dependent on the adult and don’t have to compete as much for space and other resources with other juveniles.