Recap and Introduction

Univariate Point Pattern Analysis

Code

summary(lansing)
## Marked planar point pattern:  2251 points
## Average intensity 2251 points per square unit (one unit = 924 feet)
## 
## *Pattern contains duplicated points*
## 
## Coordinates are given to 3 decimal places
## i.e. rounded to the nearest multiple of 0.001 units (one unit = 924 feet)
## 
## Multitype:
##          frequency proportion intensity
## blackoak       135 0.05997335       135
## hickory        703 0.31230560       703
## maple          514 0.22834300       514
## misc           105 0.04664594       105
## redoak         346 0.15370950       346
## whiteoak       448 0.19902270       448
## 
## Window: rectangle = [0, 1] x [0, 1] units
## Window area = 1 square unit
## Unit of length: 924 feet
str(lansing)
## List of 6
##  $ window    :List of 4
##   ..$ type  : chr "rectangle"
##   ..$ xrange: num [1:2] 0 1
##   ..$ yrange: num [1:2] 0 1
##   ..$ units :List of 3
##   .. ..$ singular  : chr "foot"
##   .. ..$ plural    : chr "feet"
##   .. ..$ multiplier: num 924
##   .. ..- attr(*, "class")= chr "unitname"
##   ..- attr(*, "class")= chr "owin"
##  $ n         : int 2251
##  $ x         : num [1:2251] 0.078 0.076 0.051 0.015 0.03 0.102 0.135 0.121 0.04 0.065 ...
##  $ y         : num [1:2251] 0.091 0.266 0.225 0.366 0.426 0.474 0.498 0.489 0.596 0.608 ...
##  $ markformat: chr "vector"
##  $ marks     : Factor w/ 6 levels "blackoak","hickory",..: 1 1 1 1 1 1 1 1 1 1 ...
##  - attr(*, "class")= chr "ppp"
names(lansing)
## [1] "window"     "n"          "x"          "y"          "markformat"
## [6] "marks"
mytest <- quadrat.test(ants)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
plot(mytest)

Question 1

What does the ants data consist of and how many points are there?

There are 97 poins within the ants data set and this data consists of PPP data.

code

ants
## Marked planar point pattern: 97 points
## Multitype, with levels = Cataglyphis, Messor 
## window: polygonal boundary
## enclosing rectangle: [-25, 803] x [-49, 717] units (one unit = 0.5 feet)

Question 2

Is it marked, and, if so, what do the marks represent?

The data is marked with two levels / ant types = Cataglyphis and Messor

Question 3

Based on your Chi-square test, would you accept or reject Ho?

The p-value = 0.5417 which means we would not reject the Ho because this value is Greater than 0.05 so we could hypothosis with the information we have currently that the ants are random.

Code

mytest
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  ants
## X2 = 18.512, df = 23, p-value = 0.5417
## alternative hypothesis: two.sided
## 
## Quadrats: 24 tiles (irregular windows)

Question 4

Make a histogram of the residuals from mytest.

Code

resids <- residuals(mytest)

hist(resids, 
     main = "Histogram of Quadrat Residuals", 
     xlab = "Residuals (Observed - Expected)", 
     col = "lightblue", border = "black")

Question 5

Conduct Chi-square tests for each species of ant separately. Report and interpret your P-values.

Cataglyphis ants P-Value is 0.1575

Messor ant P-Value is 0.2219

Both ants P-Values are very small and would still be concidered random

Code

levels(marks(ants))
## [1] "Cataglyphis" "Messor"
ants_split <- split(ants)
results <- lapply(ants_split, quadrat.test)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
results
## $Cataglyphis
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  X[[i]]
## X2 = 33.133, df = 23, p-value = 0.1575
## alternative hypothesis: two.sided
## 
## Quadrats: 24 tiles (irregular windows)
## 
## $Messor
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  X[[i]]
## X2 = 15.153, df = 23, p-value = 0.2219
## alternative hypothesis: two.sided
## 
## Quadrats: 24 tiles (irregular windows)

Question 6

Perform this analysis for the ants data (ignoring species) and plot the result. You can do this exactly as you did for cells in Lab 3. What would you conclude from this result?

This Graph not is not showing the Red line because it is coved up and following the same path as the random spatial disruption line. Meaning the ants are still random.

Code

ants_nn <- nndist(ants, k = 1:100)
ants_ann <- colMeans(ants_nn)

sim_ppp <- rpoispp(500)
sim_nn <- nndist(sim_ppp, k = 1:100)
sim_ann <- colMeans(sim_nn)

plot(1:length(sim_ann), sim_ann,
     xlab = "Neighbor Order (k)",
     ylab = "Average Nearest Neighbor Distance",
     main = "ANN Values for Ants vs CSR",
     type = "b", pch = 19)

points(1:length(ants_ann), ants_ann, pch = 5, col = "red")
lines(1:length(ants_ann), ants_ann, col = "red", lty = 2)

legend("bottomright",
       legend = c("CSR (random)", "Ants dataset"),
       pch = c(19, 5), col = c("black", "red"), lty = c(1, 2))

Multi Type and Bivariate Point Pattern Analysis

Code

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.

Question 7

Run the above code and interpret the results. What do these three graphs tell you? Do they all give a consistent message?

From all of the graphs constructed the Gij(r) was below / less than 1 on the graph meaning that these trees are repelling eatchother.

Question 8

Modify this for the ants data to evaluate whether ant nests of the two different species are random, over-, or under-dispersed. Interpret your result.

From the graphs constructed the two lines are over lapping eachother meaning that these two ants are randomized spatially.

Code

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

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

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

Code

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)

Question 9

Does there appear to be a deviation from the null expectation? If so, at what distances?

At the null expectation there is a ~ 0.25 deviation.

Question 10

Does the deviation suggest positive or negative association?

This deviation presents a negitive association.

Question 11

What does this mean vis a vis the question of whether trees tend to be near other trees of similar size, or whether they tend to be near trees of different sizes?

This shows that trees are more likely to be nere trees of different sizes. Maybe its because bigger trees need more nutrents and take over more ground. and smaller trees need to be nere big trees for protection theres more questions we could dive into now knowing this.

Question 12

Perform a similar analysis with the anemones dataset and intepret the resulting output. What does this tell you about the relationships between distance from nearest neighbors and size in sea-anemones? Construct a hypothesis that would explain the relationship, i. e. what might lead to a pattern like this?

The Hypothesis I could make for this sea anemones could be because there is a negitive assosciation between size and distance than as sea anemones are located closer together there size will be differnt, possibly for competition for space and resources.

Code

anemones
## Marked planar point pattern: 231 points
## marks are numeric, of storage type  'integer'
## window: rectangle = [0, 280] x [0, 180] units
E_anem <- 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(E_anem)