Question 1

A <- rpoispp(500)
plot(A)
## OR
rpoispp(500) |> plot()

Question 2

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

It makes the object “pp” exist as a set of contour lines on top of the density plot, rather than creating a new plot.

Question 3

plot(quadratcount(pp, nx = 10, ny = 10))

The numbers represent the number of points existing within each of the 100 grid squares.

Question 4

Number of Points Number of Grid Cells P-values Interpretations
500 400 0.09896 There is a 9.9% chance that this result occurred randomly.
750 225 0.9136 There is an extremely high likelihood (91%) that this result occurred randomly.
250 64 0.6136 There is a very high chance of 61% that this result occurred randomly.

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)

1st time: P-value = 0.6401, statistically significant result, highly probable (64%) that the distribution of points was random. 2nd time: P-value = 0.001535, statistically insignificant result, highly unlikely (0.15%) chance that the distribution of points was random. 3rd time: P-value = 0.02173, statistically insignificant result, 2.17% chance that the distribution of points was random.

Question 6

quadrat.test(pp, nx=12, ny=12)
quadrat.test(pp, nx=20, ny=20)

I switched the grid squares firstly to 12x12 and secondly to 20x20. Switching to 12x12 resulted in a P-value of 0.07635. This is more than 7% likelihood that the distribution of the points is random. Switching to 20x20 resulted in a P-value of 0.6398. This is is more than 63% chance that the distribution of points is random. Increasing the number of grid squares increases the P-value, and importantly results in an interpretation that the points are more likely to be random.

Question 7

split(lansing)

This prompt gives back data about the points, with the unit distance being 924ft. Therefore the area in sq. ft. is 924ft x 924ft = 853,776ft^2.

Question 8

This involves adding the total number of marked points together. 135 + 703 + 514 + 105 + 346 + 448 = 2251 total trees in the lansing dataset.

Question 9

Most abundant = hickory (703). Least abundant = blackoak (135)

Question 10

  1. Hickory is the most abundant species and displays a clustered dispersion of trees. This is because there are many quadrats with very few (under 5) hickory trees in, while there are some with many (15 plus). Therefore, a lot of hickory trees are clustering together in the few quadrats. Maple is the second most abundant species and the histogram displays many quadrats to have no maple trees, while roughly an equal amount have between 1-10 trees. This suggests that there is a clear clustering of maples, especially as there are still some quadrats with lots of maple trees.
Trees <- split(lansing)
plot(Trees)
plot(Trees$hickory)
plot(density(Trees$hickory))
contour(density(Trees$hickory), add=T)
quadratcount(Trees$hickory, nx = 10, ny = 10)
plot(quadratcount(Trees$hickory, nx = 10, ny = 10))
hist(quadratcount(Trees$hickory, nx = 10, ny = 10))

plot(Trees$maple)
plot(density(Trees$maple))
contour(density(Trees$maple), add=T)
quadratcount(Trees$maple, nx = 10, ny = 10)
plot(quadratcount(Trees$maple, nx = 10, ny = 10))
hist(quadratcount(Trees$maple, nx = 10, ny = 10))
  1. Blackoak is least abundant, and the histogram has very many quadrants (60 plus) with zero or only one blackoaks in them. Meanwhile the histogram displays the area to have very few quadrats with a lot of blackoack trees. This suggests that there is a high degree of clustering. Redoak is the second least abundant tree species and this histogram suggests another very clustered dispersion of redoak trees. This is evident as more than 40 quadrats have between 0 and 2 redoaks, while very few, only 1 or 2 quadrats have more than 12 redoaks. However, the existence of the quadrats with many trees suggesting clumping behaviour.
plot(Trees$blackoak)
plot(density(Trees$blackoak))
contour(density(Trees$blackoak), add=T)
quadratcount(Trees$blackoak, nx = 10, ny = 10)
plot(quadratcount(Trees$blackoak, nx = 10, ny = 10))
hist(quadratcount(Trees$blackoak, nx = 10, ny = 10))

plot(Trees$redoak)
plot(density(Trees$redoak))
contour(density(Trees$redoak), add=T)
quadratcount(Trees$redoak, nx = 10, ny = 10)
plot(quadratcount(Trees$redoak, nx = 10, ny = 10))
hist(quadratcount(Trees$redoak, nx = 10, ny = 10))

Question 11

hickory <- Trees$hickory
quadrat.test(hickory, nx=12, ny=12)

maple <- Trees$maple
quadrat.test(maple, nx=12, ny=12)
  1. Hickory P-value = 2.2e-16, suggesting an incredibly low chance that the results given are from complete spatial randomness (CSR). Maple P-value = 2.2e-16, suggesting almost 0% chance that the results given are from CSR.
blackoak <- Trees$blackoak
quadrat.test(blackoak, nx=12, ny=12)  

redoak <- Trees$redoak
quadrat.test(redoak, nx=12, ny=12)
  1. Blackoak P-value = 2.2e-16, suggesting almost 0% likelihood that the results given are from CSR. Redoak P-value = 1.957e-08, suggesting almost 0% likelihood that the results given are from CSR. Therefore, both of these results are statistically insignificant.

Question 12

quadrat.test(hickory, nx=5, ny=5)
quadrat.test(hickory, nx=20, ny=20)
quadrat.test(hickory, nx=60, ny=60)
quadrat.test(hickory, nx=100, ny=100)
quadrat.test(hickory, nx=200, ny=200)
quadrat.test(hickory, nx=300, ny=300)

5x5 P-value = 2.2e-16, 20x20 P-value = 2.2e-16, 60x60 P-value = 3.854e-08, 100x100 P-value = 0.0005939, 200x200 P-value = 0.0004216, 300x300 P-value = 3.012e-08. My interpretation of the dispersion of hickory trees remains the same, that is that they are clustered. Despite the P-value increasing, it crucially stays under 0.05. Therefore is not statistically significant and the results can still be trusted.

Question 13

MeanNND <- apply(nndist(rpoispp(500), k=1:500), 2, FUN = mean)
plot(MeanNND)
## OR 
rpoispp(500) |> nndist(k=1:500) |> apply(2, FUN = mean) |> plot()

Question 14

The plot suggests the maple trees are all closer to their mean-nearest neighbours than the random (null) mean-nearest neighbour predicts.

Question 15

The plot suggests that the mean nearest neighbour distance of cells is further away than the random (null) mean-nearest neighbour dispersion. This means that the cells are more regularly dispersed than random.

Question 16

plot(Gest(Trees$hickory))
G_env <- envelope(Trees$hickory, Gest, nsim = 95, alpha  = 0.05)
plot(G_env)

The hickory data does leave the 95% confidence bounds, going above the upper bound. This suggests that the nearest neighbour is closer than in the dashed-line random distribution, therefore resulting in clumping of hickory trees.

Question 17

plot(Gest(Trees$blackoak))
G_env <- envelope(Trees$blackoak, Gest, nsim = 95, alpha  = 0.05)
plot(G_env)

The blackoak observed data is significantly above the dashed random distribution line, and is out of the upper bound of 95% confidence interval. Therefore, there is clumping occurring with the blackoak trees, as they are all closer to each other, shortening the distance to their nearest neighbours.

Question 18

plot(Gest(cells))
G_env <- envelope(cells, Gest, nsim = 95, alpha  = 0.05)
plot(G_env)

The cells observed data is breaching the lower bound of the confidence band and is below the dashed line of random dispersion. This suggests avoidance in the cells as many of the nearest other cells are very far away from each other cell.

Question 19

plot(Gest(longleaf))
G_env <- envelope(longleaf, Gest, nsim = 95, alpha  = 0.05)
plot(G_env)

The longleaf observed data is above the dashed random line and exceeds the upper confidence limit. This graph suggests clumping of points as their nearest neighbours are closer to each other than the random distribution.