Row two columns two and three have the lowest density of trees.
The highest point density on the contour map is 0.018.
quadrat.test(bei, tess=mytess)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## 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 lowest density shown in the above map is zero. Based on my quadrat test, there is evidence to reject the null hypothesis that there is complete spatial randomness.
b <- quantile(slope, probs = (0:5)/5)
slopecut <- cut(slope, breaks=b, labels=1:5)
V <- tess(image = slopecut)
plot(V)
plot(bei, add=T, pch ="+")
quadcount <- quadratcount(bei, tess=V)
plot(quadcount)
quadrat.test(bei, tess=V)
##
## Chi-squared test of CSR using quadrat counts
##
## data: bei
## X2 = 587, df = 4, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 tiles (levels of a pixel image)
b
## 0% 20% 40% 60% 80% 100%
## 0.0008663357 0.0351263200 0.0531477800 0.0780709100 0.1287942000 0.3284767000
Breaks: 0% 20% 40% 60% 80% 100% 0.0008663357 0.0351263200 0.0531477800 0.0780709100 0.1287942000 0.3284767000
e <- quantile(elev, probs = (0:5)/5)
elevcut <- cut(elev, breaks=e, labels=1:5)
x <- tess(image = elevcut)
plot(x)
plot(bei, add=T, pch ="+")
quadcount1 <- quadratcount(bei, tess=x)
plot(quadcount1)
quadrat.test(bei, tess=x)
##
## Chi-squared test of CSR using quadrat counts
##
## data: bei
## X2 = 567.09, df = 4, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 tiles (levels of a pixel image)
quadcount1
## tile
## 1 2 3 4 5
## 490 719 861 1174 360
Number in each quintile 1:490 2:719 3:861 4:1174 5:360
quadrat.test(bei, tess=x)
##
## Chi-squared test of CSR using quadrat counts
##
## data: bei
## X2 = 567.09, df = 4, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 tiles (levels of a pixel image)
quadrat.test(bei, tess=V)
##
## Chi-squared test of CSR using quadrat counts
##
## data: bei
## X2 = 587, df = 4, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 tiles (levels of a pixel image)
Both elevation and slope significantly affect the spatial randomness of trees. However, since slope has a higher X^2 than elevation, it is slightly better at explaining the non-random distribution of the trees in this dataset.
plot(rhohat(bei, slope))
The dashed line on the above graph represents spatial randomness.
As slope increases, the presence of trees increases up until about a slope of 0.32 where trees can no longer survive on such a slope.
## Point process model
## Fitted to data: bei
## Fitting method: maximum likelihood (Berman-Turner approximation)
## Model was fitted using glm()
## Algorithm converged
## Call:
## ppm.formula(Q = bei ~ slope * elev)
## Edge correction: "border"
## [border correction distance r = 0 ]
## --------------------------------------------------------------------------------
## Quadrature scheme (Berman-Turner) = data + dummy + weights
##
## Data pattern:
## Planar point pattern: 3604 points
## Average intensity 0.00721 points per square metre
## Window: rectangle = [0, 1000] x [0, 500] metres
## Window area = 5e+05 square metres
## Unit of length: 1 metre
##
## Dummy quadrature points:
## 130 x 130 grid of dummy points, plus 4 corner points
## dummy spacing: 7.692308 x 3.846154 metres
##
## Original dummy parameters: =
## Planar point pattern: 16904 points
## Average intensity 0.0338 points per square metre
## Window: rectangle = [0, 1000] x [0, 500] metres
## Window area = 5e+05 square metres
## Unit of length: 1 metre
## Quadrature weights:
## (counting weights based on 130 x 130 array of rectangular tiles)
## All weights:
## range: [1.64, 29.6] total: 5e+05
## Weights on data points:
## range: [1.64, 14.8] total: 41000
## Weights on dummy points:
## range: [1.64, 29.6] total: 459000
## --------------------------------------------------------------------------------
## FITTED :
##
## Nonstationary Poisson process
##
## ---- Intensity: ----
##
## Log intensity: ~slope * elev
## Model depends on external covariates 'slope' and 'elev'
## Covariates provided:
## slope: im
## elev: im
##
## Fitted trend coefficients:
## (Intercept) slope elev slope:elev
## -4.403426761 -36.500458701 -0.007024363 0.292813497
##
## Estimate S.E. CI95.lo CI95.hi Ztest
## (Intercept) -4.403426761 0.614763210 -5.60834051 -3.198513010 ***
## slope -36.500458701 5.261456400 -46.81272375 -26.188193651 ***
## elev -0.007024363 0.004192219 -0.01524096 0.001192235
## slope:elev 0.292813497 0.036257125 0.22175084 0.363876155 ***
## Zval
## (Intercept) -7.162801
## slope -6.937330
## elev -1.675572
## slope:elev 8.076026
##
## ----------- gory details -----
##
## Fitted regular parameters (theta):
## (Intercept) slope elev slope:elev
## -4.403426761 -36.500458701 -0.007024363 0.292813497
##
## Fitted exp(theta):
## (Intercept) slope elev slope:elev
## 1.223534e-02 1.406217e-16 9.930002e-01 1.340193e+00
In this model the intercept, slope, and slope and elevation are the significant variables.
ppmmodel <- ppm(bei ~ slope * elev)
slrmmodel <- slrm(bei ~ slope*elev)
ppmmodel
## Nonstationary Poisson process
## Fitted to point pattern dataset 'bei'
##
## Log intensity: ~slope * elev
##
## Fitted trend coefficients:
## (Intercept) slope elev slope:elev
## -4.403426761 -36.500458701 -0.007024363 0.292813497
##
## Estimate S.E. CI95.lo CI95.hi Ztest
## (Intercept) -4.403426761 0.614763210 -5.60834051 -3.198513010 ***
## slope -36.500458701 5.261456400 -46.81272375 -26.188193651 ***
## elev -0.007024363 0.004192219 -0.01524096 0.001192235
## slope:elev 0.292813497 0.036257125 0.22175084 0.363876155 ***
## Zval
## (Intercept) -7.162801
## slope -6.937330
## elev -1.675572
## slope:elev 8.076026
slrmmodel
## Fitted spatial logistic regression model
## Formula: bei ~ slope * elev
## Fitted coefficients:
## (Intercept) slope elev slope:elev
## -4.330416600 -36.301093115 -0.009931764 0.303478908
plot(ppmmodel)
plot(slrmmodel)
summary(slrmmodel)
## Fitted spatial logistic regression model
## Call: [1] "slrm(bei ~ slope * elev)"
## Formula: bei ~ slope * elev
## Fitted coefficients:
## Estimate S.E. CI95.lo CI95.hi Ztest
## (Intercept) -4.330416600 0.766832930 -5.83338152 -2.827452e+00 ***
## slope -36.301093115 6.687911473 -49.40915873 -2.319303e+01 ***
## elev -0.009931764 0.005245837 -0.02021342 3.498863e-04
## slope:elev 0.303478908 0.046448056 0.21244239 3.945154e-01 ***
## Zval
## (Intercept) -5.647145
## slope -5.427867
## elev -1.893266
## slope:elev 6.533727
summary(ppmmodel)
## Point process model
## Fitted to data: bei
## Fitting method: maximum likelihood (Berman-Turner approximation)
## Model was fitted using glm()
## Algorithm converged
## Call:
## ppm.formula(Q = bei ~ slope * elev)
## Edge correction: "border"
## [border correction distance r = 0 ]
## --------------------------------------------------------------------------------
## Quadrature scheme (Berman-Turner) = data + dummy + weights
##
## Data pattern:
## Planar point pattern: 3604 points
## Average intensity 0.00721 points per square metre
## Window: rectangle = [0, 1000] x [0, 500] metres
## Window area = 5e+05 square metres
## Unit of length: 1 metre
##
## Dummy quadrature points:
## 130 x 130 grid of dummy points, plus 4 corner points
## dummy spacing: 7.692308 x 3.846154 metres
##
## Original dummy parameters: =
## Planar point pattern: 16904 points
## Average intensity 0.0338 points per square metre
## Window: rectangle = [0, 1000] x [0, 500] metres
## Window area = 5e+05 square metres
## Unit of length: 1 metre
## Quadrature weights:
## (counting weights based on 130 x 130 array of rectangular tiles)
## All weights:
## range: [1.64, 29.6] total: 5e+05
## Weights on data points:
## range: [1.64, 14.8] total: 41000
## Weights on dummy points:
## range: [1.64, 29.6] total: 459000
## --------------------------------------------------------------------------------
## FITTED :
##
## Nonstationary Poisson process
##
## ---- Intensity: ----
##
## Log intensity: ~slope * elev
## Model depends on external covariates 'slope' and 'elev'
## Covariates provided:
## slope: im
## elev: im
##
## Fitted trend coefficients:
## (Intercept) slope elev slope:elev
## -4.403426761 -36.500458701 -0.007024363 0.292813497
##
## Estimate S.E. CI95.lo CI95.hi Ztest
## (Intercept) -4.403426761 0.614763210 -5.60834051 -3.198513010 ***
## slope -36.500458701 5.261456400 -46.81272375 -26.188193651 ***
## elev -0.007024363 0.004192219 -0.01524096 0.001192235
## slope:elev 0.292813497 0.036257125 0.22175084 0.363876155 ***
## Zval
## (Intercept) -7.162801
## slope -6.937330
## elev -1.675572
## slope:elev 8.076026
##
## ----------- gory details -----
##
## Fitted regular parameters (theta):
## (Intercept) slope elev slope:elev
## -4.403426761 -36.500458701 -0.007024363 0.292813497
##
## Fitted exp(theta):
## (Intercept) slope elev slope:elev
## 1.223534e-02 1.406217e-16 9.930002e-01 1.340193e+00
The coefficient for slope:elev using the ppm model is 0.29, while the coefficient for the slrm model is 0.30. While they produced different results both were fairly similar. Both slope:elev variables are significant but the slope:elev for the ppmmodel has a higher Z-value making it more sigificant.
gor_subset <- gorillas[marks(gorillas)$group == "minor" &
marks(gorillas)$season == "rainy", ]
gor_subsetdry <- gorillas[marks(gorillas)$group == "major" &
marks(gorillas)$season == "dry", ]
gor_subsetdry
## Marked planar point pattern: 150 points
## Mark variables: group, season, date
## window: polygonal boundary
## enclosing rectangle: [580457.9, 585934] x [674172.8, 678739.2] metres
There are 150 points for the major group during the dry season.
veg_tess <- tess(image = gorillas.extra$vegetation)
quadratcount(gor_subsetdry, tess=veg_tess)
## tile
## Disturbed Colonising Grassland Primary Secondary Transition
## 24 0 2 120 2 2
quadrat.test(gor_subsetdry, tess=veg_tess)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## Chi-squared test of CSR using quadrat counts
##
## data: gor_subsetdry
## X2 = 183.29, df = 5, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 6 tiles (levels of a pixel image)
There is evidence for a non-random spatial distribution by vegetation type. The primary vegetation type has the highest number of nests.
veg_tess <- tess(image = gorillas.extra$slopetype)
quadratcount(gor_subsetdry, tess=veg_tess)
## tile
## Valley Toe Flat Midslope Upper Ridge
## 55 12 0 21 4 58
quadrat.test(gor_subsetdry, tess=veg_tess)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
##
## Chi-squared test of CSR using quadrat counts
##
## data: gor_subsetdry
## X2 = 5.0863, df = 5, p-value = 0.8109
## alternative hypothesis: two.sided
##
## Quadrats: 6 tiles (levels of a pixel image)
There is no significant difference across slopetype. The ridge slopetype has the highest number of nests.
###Slope
quadrat.test(gor_subsetdry, tess=V)
##
## Chi-squared test of CSR using quadrat counts
##
## data: gor_subsetdry
## X2 = 600, df = 4, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 tiles (levels of a pixel image)
###Elev
quadrat.test(gor_subsetdry, tess=x)
##
## Chi-squared test of CSR using quadrat counts
##
## data: gor_subsetdry
## X2 = 599.63, df = 4, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 5 tiles (levels of a pixel image)
The above quadrat test shows that slope significantly impacts the spatial point patterns of gorillas nests for major groups during the dry season. The p-value is nearly zero which is less that 0.05. Therefore, we can reject the null hypothesis that there is no relationship.
slopegor <- gorillas.extra$slopeangle
elevgor <- gorillas.extra$elevation
slrmm <- slrm(gor_subsetdry ~ slopegor*elevgor)
slrmm
## Fitted spatial logistic regression model
## Formula: gor_subsetdry ~ slopegor * elevgor
## Fitted coefficients:
## (Intercept) slopegor elevgor slopegor:elevgor
## -2.880176e+01 2.372978e-01 9.322878e-03 -1.236946e-04
plot(slrmm)
The slope and elevation variable is a slight negative, almost zero which means the effect of slope becomes less positive at higher elevations.