A <- rpoispp(500)
plot(A)
## OR
rpoispp(500) |> plot()
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.
plot(quadratcount(pp, nx = 10, ny = 10))
The numbers represent the number of points existing within each of the 100 grid squares.
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. |
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.
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.
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.
This involves adding the total number of marked points together. 135 + 703 + 514 + 105 + 346 + 448 = 2251 total trees in the lansing dataset.
Most abundant = hickory (703). Least abundant = blackoak (135)
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))
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))
hickory <- Trees$hickory
quadrat.test(hickory, nx=12, ny=12)
maple <- Trees$maple
quadrat.test(maple, nx=12, ny=12)
blackoak <- Trees$blackoak
quadrat.test(blackoak, nx=12, ny=12)
redoak <- Trees$redoak
quadrat.test(redoak, nx=12, ny=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.
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()
The plot suggests the maple trees are all closer to their mean-nearest neighbours than the random (null) mean-nearest neighbour predicts.
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.
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.
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.
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.
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.