Question 1

Row 2, column 3 and row 2, column 2 are the two quadrats with the lowest density.

Question 2

The highest point in the contour plot, the highest point density contour is 0.02.

Question 3

The lowest density value in a complete polygon is 0. There is evidence to reject the null hypothesis of complete spatial randomness because the p-value was 2.2e-16.

Question 4

slope <- gorillas.extra$slopeangle
b_slope <- quantile(slope, probs = (0:5)/5)
slopecut <- cut(slope, breaks=b_slope, labels=1:5)
V_slope <- tess(image = slopecut)
plot(V_slope)
plot(bei, add=T, pch = "+")

quadcount_slope <- quadratcount(bei, tess=V_slope)
## Warning in quadratcount.ppp(bei, tess = V_slope): Tessellation does not contain
## all the points of X
plot(quadcount_slope)

quadrat.test(bei, tess=V_slope)
## Warning in quadratcount.ppp(X, nx = nx, ny = ny, xbreaks = xbreaks, ybreaks =
## ybreaks, : Tessellation does not contain all the points of X
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  bei
## X2 = NaN, df = 4, p-value = NA
## alternative hypothesis: two.sided
## 
## Quadrats: 5 tiles (levels of a pixel image)
elev <- gorillas.extra$elevation
b_elev <- quantile(elev, probs = (0:5)/5)
elevcut <- cut(elev, breaks=b_elev, labels = 1:5)
V_elev <- tess(image = elevcut)
plot(V_elev)
plot(bei, add=T, pch = "+")

quadcount_elev <- quadratcount(bei, tess=V_elev)
## Warning in quadratcount.ppp(bei, tess = V_elev): Tessellation does not contain
## all the points of X
plot(quadcount_elev)

quadrat.test(bei, tess=V_elev)
## Warning in quadratcount.ppp(X, nx = nx, ny = ny, xbreaks = xbreaks, ybreaks =
## ybreaks, : Tessellation does not contain all the points of X
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  bei
## X2 = NaN, df = 4, p-value = NA
## alternative hypothesis: two.sided
## 
## Quadrats: 5 tiles (levels of a pixel image)

Question 5

The quantile breaks for the slope are 0.0009, 0.0351, 0.0531, 0.0781, 0.1288,and 0.3285

Question 6

The number of points in each “quadrat” for elevation quintiles are 1=490, 2=719, 3=861, 4=1174, 5=360

Question 7

After performing a quadrat test on both variables, they had the same p-value of < 2.2e-16, meaning the distribution is not random. However, they did have different chi squared values. For slope it was 587 and for elevation it was 567.09. Because the slope value was higher, it is better at explaining the non-random distribution of points in the bei data.

Question 8

The dashed line in the resulting plot represents the mean of all the trees if they were randomly distributed.

Question 9

The plot suggests the tree intensity increases with slope with the highest intensity being at middle to sleep slopes.

Question 10

The variables that appear to be significant in this model are intercept, slope, and slope:elev.

Question 11

Both models overall show very similar results and the same conclusions can be made. The coefficients were just decimal points off and the significance were the same with all but elevation being significant.

Question 12

There are 150 sites in the reduced data set.

Question 13

There is evidence for a non-random distribution across vegetation types because the p-value is < 2.2e-16 and the vegetation type with the highest number of nests is primary.

Question 14

There is not evidence for a non-random distribution across slopetype because the p-value is 0.8109 and the slope type with the highest number of nests is Ridge.

Question 15

When elevation was split into quintiles, all 150 sites went into the first quintile, meaning they are not random and are clustered in low elevation areas. The p-value < 2.2e-16 further supports this. When slope was split, all the points were in the 5th quintile. With the same p-value, it can be concluded that they are clustered in steep areas at a low elevation.

Question 16

gor_subset <- gorillas[marks(gorillas)$group == "major" &
                         marks(gorillas)$season == "dry", ]
model <- slrm(gor_subset ~ slopeangle + elevation, data = gorillas.extra)
summary(model)
## Fitted spatial logistic regression model
## Call:    [1] "slrm(gor_subset ~ slopeangle + elevation, data = gorillas.extra)"
## Formula: gor_subset ~ slopeangle + elevation
## Fitted coefficients: 
##                  Estimate         S.E.       CI95.lo       CI95.hi Ztest
## (Intercept) -23.457287383 1.1976160009 -25.804571612 -21.110003154   ***
## slopeangle    0.009773936 0.0082231591  -0.006343160   0.025891032      
## elevation     0.006441251 0.0006202028   0.005225675   0.007656826   ***
##                   Zval
## (Intercept) -19.586652
## slopeangle    1.188587
## elevation    10.385717
plot(predict(model), main = "Predicted nest likelihood")

model
## Fitted spatial logistic regression model
## Formula: gor_subset ~ slopeangle + elevation
## Fitted coefficients:
##   (Intercept)    slopeangle     elevation 
## -23.457287383   0.009773936   0.006441251

The slrm model revealed that elevation is a significant predictor for nest locations. Slopeangle was not found significant. The map revealed a similar outcome of higher elevations to have more nest likelihood.