Question 1

Lowest density of trees: column 3, row 2. 2nd Lowest density of trees: column 2, row 2.

Question 2

0.022

Question 3

mytess <- hextess(bei, 10)
Q <- quadratcount(bei, tess=mytess)
plot(bei, cex=0.5, pch="+")
plot(Q, add=TRUE, cex=1)

0 density value is the lowest in some of the hexagons for tessalation of side length 10.

Q2 <- quadrat.test(bei, tess = mytess) 
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
Q2
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  bei
## X2 = 12836, df = 1976, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## Quadrats: 1977 tiles (irregular windows)

The P-value =2.2e-16. There is no clear evidence to reject the null hypothesis of CSR here, as the p-value is very, very small and much below 0.05.

Question 4

slope <- bei.extra$grad
elev <- bei.extra$elev

b <- quantile(slope, probs = (0:5)/5)
slopecut <- cut(slope, breaks=b, labels=1:5)
V <- tess(image = slopecut)
quadcount <- quadratcount(bei, tess=V)
plot(quadcount)

b2 <- quantile(elev, probs = (0:5)/5)
elevcut <- cut(elev, breaks=b2, labels=1:5)
V2 <- tess(image = elevcut)
quadcount2 <- quadratcount(bei, tess=V2)
plot(quadcount2)

Question 5

0% - 119.81 20% - 138.15 40% - 142.40 60% - 146.27 80% - 151.98 100% - 159.48

Question 6

1 - 210 2 - 654 3 - 762 4 - 911 5 - 1067

Question 7

The p-values for both elevation and slope from the quintile quadrat test are 2.2e-16. However, the Chi-squared value for slope is 587, where as for elevation it is 567. This means that elevation only slighty better explains the non-random distribution of points than slope does.

Question 8

The dashed line represents the theoretical/predicted distribution of bei trees expected under complete spatial randomness, therefore, no example for the covariate.

Question 9

The plot on the whole suggests that as the slope gradient increases, the probability of bei trees existing increases slightly too. However, there is some variance in this pattern as from a slope gradient of 17% to 25%, the probability of bei trees decreases. The probability of bei trees then increases again until 31% gradient where it drops off significantly. Beyond this slope gradient, no trees will be found as it is too steep, presumably for soil to hold and for a tree to grow.

Question 10

In this model, the significant variables are slope, and the interaction between slope and elevation, whereas the elevation by itself is not a significant variable.

Question 11

The coefficients obtained from the ppm and slrm models are very similar on the whole. Their intercepts are -4.40 and -4.33, so very similar base starting point on a graph. The slope(gradient) is also similar being -36.50 and -36.30, meaning that they both have almost identical negative relationships. The elevation is -0.0070 for ppm and -0.0099 for slrm, so also similar, although slrm is slightly more negative. Finally, the interaction is 0.2928 for ppm and 0.3035 for slrm, indicating an agreement that as elevation increases so does the slope’s positive impact on bei trees.

The significance tests show the same results, although slrm is a slightly lower z-value than with ppm.

Question 12

150 points

Question 13

There is strong evidence for non-random distribution as the p-value is 2.2e-16. This means there is an extremely low chance the distribution was caused by CSR. Primary vegetation has the most number of nests with 120.

Question 14

The null hypothesis of CSR is not rejected as the p-value is 0.8109, meaning that there was a 81% chance that the observed distribution of nests by slopetype is given CSR. The slope type with the highest number of nests is Ridge with 58.

Question 15

The p-value from the quadrat test for slope is 0.03356, meaning that the null hypothesis of CSR is rejected as it is smaller than 0.05. There is only a 3.4% chance of the observed distribution of nests across slope angle coming from random distribution.

The p-value from the quadrat test for elevation is less than 2.2e-16. From this can confidently reject the null hypothesis of CSR as it is lower than 0.05.

Question 16

gor_subset <- gorillas[marks(gorillas)$group == "major" &
                         marks(gorillas)$season == "dry", ]
gor_model <- slrm(gor_subset ~ slopeangle*elevation, data=gorillas.extra)
summary(gor_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
## (Intercept)          -2.880176e+01 2.879526e+00 -3.444553e+01 -2.315799e+01
## slopeangle            2.372978e-01 1.070725e-01  2.743948e-02  4.471561e-01
## elevation             9.322878e-03 1.531920e-03  6.320370e-03  1.232539e-02
## slopeangle:elevation -1.236946e-04 5.802943e-05 -2.374302e-04 -9.958982e-06
##                      Ztest       Zval
## (Intercept)            *** -10.002255
## slopeangle               *   2.216234
## elevation              ***   6.085747
## slopeangle:elevation     *  -2.131584
plot(gor_model)

The coefficients of these results illustrate that as as slope angle increases, the likelihood of nest sites occurring increases. This coefficient is 2.37. However, elevation has an even greater postive effect, where as elevation increases, the likelihood of nest sites occurring increases by an larger amount than with slope. This is evident through its coefficient being 9.32.