Code
plot(rpoispp(500))
T means true and in this code means to overlay this new desity map over the “pp”.
code
plot(quadratcount(pp,nx = 10,ny = 10))
The numbers within each box represet how many of the random 500 points that were generated are in each box.
Code
quadrat.test(rpoispp(500),nx = 20,ny = 20)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## Chi-squared test of CSR using quadrat counts
##
## data: rpoispp(500)
## X2 = 407.57, df = 399, p-value = 0.7452
## alternative hypothesis: two.sided
##
## Quadrats: 20 by 20 grid of tiles
quadrat.test(rpoispp(500),nx = 20,ny = 20)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## Chi-squared test of CSR using quadrat counts
##
## data: rpoispp(500)
## X2 = 412.96, df = 399, p-value = 0.6086
## alternative hypothesis: two.sided
##
## Quadrats: 20 by 20 grid of tiles
quadrat.test(rpoispp(500),nx = 20,ny = 20)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## Chi-squared test of CSR using quadrat counts
##
## data: rpoispp(500)
## X2 = 400.31, df = 399, p-value = 0.9444
## alternative hypothesis: two.sided
##
## Quadrats: 20 by 20 grid of tiles
Code
pp <- rpoispp(function(x,y){200*x + 200*y})
quadrat.test(pp, nx=8, ny=8)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## Chi-squared test of CSR using quadrat counts
##
## data: pp
## X2 = 99.847, df = 63, p-value = 0.004289
## alternative hypothesis: two.sided
##
## Quadrats: 8 by 8 grid of tiles
plot(density(pp))
plot(pp, pch = 1, add = TRUE)
pp <- rpoispp(function(x,y){200*x + 200*y})
quadrat.test(pp, nx=3, ny=3)
##
## Chi-squared test of CSR using quadrat counts
##
## data: pp
## X2 = 43.654, df = 8, p-value = 1.323e-06
## alternative hypothesis: two.sided
##
## Quadrats: 3 by 3 grid of tiles
plot(density(pp))
plot(pp, pch = 1, add = TRUE)
pp <- rpoispp(function(x,y){200*x + 200*y})
quadrat.test(pp, nx=100, ny=100)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## Chi-squared test of CSR using quadrat counts
##
## data: pp
## X2 = 10177, df = 9999, p-value = 0.2101
## alternative hypothesis: two.sided
##
## Quadrats: 100 by 100 grid of tiles
plot(density(pp))
plot(pp, pch = 1, add = TRUE)
The higher grid amounts make the P value higher slighly but still over a small number. Smaller grid amounts visually are less grouped together possibly and larger amounts are more global trend spread out.
Code
plot(split(lansing))
plot(split(lansing)$hickory)
data(lansing)
trees <- split(lansing)
names(trees)
## [1] "blackoak" "hickory" "maple" "misc" "redoak" "whiteoak"
hickorytrees <- trees$hickory
plot(hickorytrees)
window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
Code
lansing$window
## window: rectangle = [0, 1] x [0, 1] units (one unit = 924 feet)
there are 2251 points (which are trees)
Code
numberoftrees <- npoints(lansing)
numberoftrees
## [1] 2251
Most abundant hickory (703) | Least abundant is Blackoak (135)
Code
table(marks(lansing))
##
## blackoak hickory maple misc redoak whiteoak
## 135 703 514 105 346 448
Most Common Mapel-aggrigated in clumps | Hickory 2nd most common - I think dispersed due to wide gaps. Least Common - Blackoak dispersed and scatterd | redoak - dispersed, there is some aggregation and dispersment
Code
plot(density(trees)$maple)
plot(density(trees)$hickory)
plot(density(trees)$blackoak)
plot(density(trees)$redoak)
Most common - These are such a small number for the P Value that there NOT RANDOM Mapel - p-value < 2.2e-16 Hickory - p-value < 2.2e-16
Least Common These are such a small number for the P Value that there NOT RANDOM Blackoak - p-value < 2.2e-16 Redoak - p-value = 1.061e-05
Code
quadrat.test(trees$maple)
##
## Chi-squared test of CSR using quadrat counts
##
## data: trees$maple
## X2 = 216.93, df = 24, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 by 5 grid of tiles
quadrat.test(trees$hickory)
##
## Chi-squared test of CSR using quadrat counts
##
## data: trees$hickory
## X2 = 233.45, df = 24, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 by 5 grid of tiles
quadrat.test(trees$blackoak)
##
## Chi-squared test of CSR using quadrat counts
##
## data: trees$blackoak
## X2 = 145.56, df = 24, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 by 5 grid of tiles
quadrat.test(trees$redoak)
##
## Chi-squared test of CSR using quadrat counts
##
## data: trees$redoak
## X2 = 67.439, df = 24, p-value = 1.061e-05
## alternative hypothesis: two.sided
##
## Quadrats: 5 by 5 grid of tiles
With the results below I would say this is the over all trend of our data set
Code
q1 <- quadrat.test(trees$hickory, nx = 3, ny = 3)
q2 <- quadrat.test(trees$hickory, nx = 5, ny = 5)
q3 <- quadrat.test(trees$hickory, nx = 10, ny = 10)
Code
plot(apply(nndist(rpoispp(500), k=1:500), 2, FUN = mean))
NNDC <- plot(apply(nndist(rpoispp(500), k=1:500), 2, FUN = mean))
plot(colMeans(nndist(rpoispp(500), k=1:500), 2))
The plot above suggestes that hte data is clustered because the curve lies below the null curve = trees are closer to their neighbors than expected
Code
hist(apply(nndist(rpoispp(500), k=1:500), 2, FUN = mean))
plot(apply(nndist(rpoispp(500), k=1:100), 2, FUN = mean),
xlab = "Neighbor Order (k)",
ylab = "Average Nearest Neighbor Distance",
main = "ANN Values for Different Neighbor Orders",
type = "b", # Plot points connected by lines
pch = 19) # Solid circles for points
nn_distances <- nndist(split(lansing)$maple, k = 1:100)
ann_values <- colMeans(nn_distances)
points(1:length(ann_values), ann_values,
pch = 5) #Open squares for points
This plot suggests that the distrabution may be regular spacing because its consistatly above the ANN curve.
Code
n_cells <- npoints(cells)
plot(apply(nndist(rpoispp(n_cells), k=1:n_cells), 2, mean),
type="b", pch=19,
xlab="Neighbor Order (k)",
ylab="Average NN Distance",
main="ANN: Cells vs Random")
nn_cells <- nndist(cells, k=1:n_cells)
ann_cells <- colMeans(nn_cells)
points(1:length(ann_cells), ann_cells, pch=5)
##Does the data wander beyond the bounds of the confidence band? If so, above or below? Does this graph suggest randomness, clumping or aversion in the hickory data? This data for Hickory trees does in fact go over outside of the bounds.This is suggesting small amounts of clumping because there are a few more shorter distances than would be expected if it was random.
Code
pp <- rpoispp(function(x,y) {200*x + 200*y})
plot(Gest(pp))
G_env <- envelope(rpoispp(500), 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)
G_env_hickory <- envelope(split(lansing)$hickory, 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_hickory, main="G-function: Hickory")
This data for Black oak is almost always consistatly above our line meaning the data is clumping
Code
G_env_blackoak <- envelope(split(lansing)$blackoak, 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_blackoak, main="G-function: Blackoak")
This data for the Cells is constantly below the graph meaning it is experiencing a dispersed or regular patern.
Code
G_env_cells <- envelope(cells, 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_cells, main="G-function: Cells")
This data for Longleafs is consistantly above our graphed line and so the data is clumping.
Code
G_env_longleaf <- envelope(longleaf, 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_longleaf, main="G-function: Longleaf")