mytest <- quadrat.test(ants)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
plot(mytest)

Problem 1

The ants data gives the “spatial locations of nests of two species of ants, Messor wasmanni and Cataglyphis bicolor.” It has 97 points (or nests).

Problem 2

The ants data is a “multitype point pattern object, each point carrying a mark indicating the ant species.”

Problem 3

Based on my Chi-square test, I would fail to reject the null hypothesis

Problem 4

# Extract residuals from quadrat test
resids <- residuals(mytest)

# Make a histogram
hist(resids,
     main = "Histogram of Quadrat Test Residuals",
     xlab = "Residuals",
     col = "indianred1",
     border = "black")

Problem 5

# Split the data into separate species
messor <- ants[ants$marks == "Messor"]
cataglyphis <- ants[ants$marks == "Cataglyphis"]

# Run quadrat test for each species separately
messor_test <- quadrat.test(messor)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
cataglyphis_test <- quadrat.test(cataglyphis)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
# Print results
messor_test
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  messor
## X2 = 15.153, df = 23, p-value = 0.2219
## alternative hypothesis: two.sided
## 
## Quadrats: 24 tiles (irregular windows)
cataglyphis_test
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  cataglyphis
## X2 = 33.133, df = 23, p-value = 0.1575
## alternative hypothesis: two.sided
## 
## Quadrats: 24 tiles (irregular windows)

The p-value of the Messor species is 0.2219, meaning I fail to reject the null hypothesis.

The p-value of the Cataglyphis species is 0.1575, meaning I fail to reject the nul hypothesis.

Problem 6

G_env <- envelope(ants, Gest, nsim = 95, alpha  = 0.05)
## Generating 95 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.
## 
## Done.
plot(G_env)

From this result, I would conclude that there is neither clumping nor regularity, meaning it is spatially random. The data hovers slightly below the dashed null curve, possibly indicating a small level of regularity, but not enough to be significant.

Problem 7

envelope(lansing, Gcross, nsim = 99, i = 'maple', j = 'hickory') |> plot()
## 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.

envelope(lansing, Kcross, nsim = 99, i = 'maple', j = 'hickory') |> plot()
## 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.

envelope(lansing, pcfcross, nsim = 99, i = 'maple', j = 'hickory') |> plot()
## 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.

These graphs, while measuring spatial distribution differently, consistently communicate that the trees in the lansing data set exhibit a cross-type repulsion.

Problem 8

envelope(ants, Gcross, nsim = 99, i = 'Messor', j = 'Cataglyphis') |> plot()
## 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.

envelope(ants, Kcross, nsim = 99, i = 'Messor', j = 'Cataglyphis') |> plot()
## 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.

envelope(ants, pcfcross, nsim = 99, i = 'Messor', j = 'Cataglyphis') |> plot()
## 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.

These three graphs all consistently display that the species in the ants data set are spatially independent of one another, with no apparent attraction or repulsion between the two types.

Problem 9

E <- envelope(longleaf, markcorr, nsim=99)
## 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.
plot(E)

There is a significant deviation from the null expectation, from 0-12 meters.

Problem 10

The deviation suggests negative association.

Problem 11

This means that, closer to one particular tree, there tends to be many trees with a variety of different diameters. Beyond the ~12 meter buffer, it shifts to a lack of correlation, meaning the diameters of trees become more independent of the particular tree’s diameter.

Problem 12

A <- envelope(anemones, markcorr, nsim=99)
## 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.
plot(A)

This graph’s pattern is quite similar to that of the lansing data set. For the first 10 or so meters, the value is less than one, indicating a negative association. This means that nearby a particular anemone, anemones with different sizes tend to be found close to one another. Beyond 10 meters, there is a lack of correlation, meaning the sizes of anemone at a distance are independent. This negative association deviation within a short radius could be explained by large adults suppressing equally large competitors but attracting/allowing recruitment of small juveniles nearby.