Question 1

myobj = rpoispp(500) 
plot(myobj)
rpoispp(500)|>
plot()
  
pp <- rpoispp(500)
plot(density(pp))
contour(density(pp), add=T)
plot(pp, add=T)

Question 2

add=T means the changes are not being applied to a new plot and being applied to the existing plot instead.

Question 3

The numbers within the squares are the number of circles that are within each quadrat.

Question 4

# of points # of grid cells P-values Interpretation
500 400 0.2591 random
200 200 0.8081 random
700 900 0.682 random
{quadrat.test(rpoispp(500), nx = 20, ny = 20)} 
quadrat.test(rpoispp(200), nx = 10, ny = 10) 
quadrat.test(rpoispp(700), nx = 30, ny = 30)

Question 5

pp <- rpoispp(function(x,y) {200*x + 200*y})
quadrat.test(pp, nx=8, ny=8)
plot(density(pp))
plot(pp, pch=1, add=TRUE)

p-value = 0.008854; It is not random

pp <- rpoispp(function(x,y) {200*x + 100*y})
quadrat.test(pp, nx=8, ny=8)
plot(density(pp))
plot(pp, pch=1, add=TRUE)

p-value = 0.04826; It is not random

pp <- rpoispp(function(x,y) {20*x + 200*y})
quadrat.test(pp, nx=8, ny=8)
plot(density(pp))
plot(pp, pch=1, add=TRUE)

p-value = 0.01451; It is not random.

Question 6

Yes, the grid size can effect the interpretation of p-values. The smaller the grid size, the easier it is to detect trends because the bigger grid sizes with more points could mask trends and could slightly change the p-value. However, on the more extreme p-values, a trend is detected no matter what the grid size so the interpretation would not change.

Question 7

The study area is 853,776 square feet.

Question 8

There are 2251 trees in the Lansing data set.

Question 9

The most abundant tree is the hickory and the least abundant tree is black oak.

Question 10

  1. Hickory and maple trees are both aggregated.
  2. Black oak trees are aggregated.

Question 11

  1. They are both not random, so they are aggregated.
  2. Black oak is not random, so it is aggregated.

Question 12

Yes, the interpretation of the results are robust to variation in quadrat size.

Question 13

pp <- rpoispp(500)
nn_means <- apply(nndist(pp, k=1:500), 2, mean)
plot(nn_means, type = "l")

rpoispp(500) |>
  nndist(k=1:500) |>
  apply(2, mean) |>
  plot(type = "b")

Question 14

The plot suggests that the maple trees are aggregated because the line falls below the random line meaning it has a shorter nearest neighbor distance.

Question 15

The plot suggests that the cells are dispersed because the cells line is above the random line meaning they have a longer nearest neighbor distance.

Question 16

The data somewhat wanders above the bounds of the confidence band in the middle of the graph This suggests the hickory trees are mostly random and sightly aggregated during those middle distances.

Question 17

The data wanders above the bounds of the confidence band. This suggests that black oak tress are aggregated.

Question 18

The data wanders below the the confidence band. This suggests the cells dataset is dispersed.

Question 19

The data wanders above the bounds of the confidence band. This suggests the long leaf trees are aggregated.