GEOG 6000
Date: 11/25/2015
Sulochan Dhungel
Reading in files, and converting them into a point process object (ppp)
setwd("C:/Users/Sulochan/Copy/Fall 2015/Advance Geo/Assignment 7")
# Tree locations
urkiola.sp <- readShapeSpatial("urkiola.shp")
# Park boundary
urkiola.win <- readShapeSpatial("urkiolaWindow.shp")
# First convert boundary to owin object
y <- as(urkiola.win, "SpatialPolygons")
# Then convert SpatialPolygons to owin class
urkiola.owin <- as(y, "owin")
# Now get tree coordinates
urkiola.x <- coordinates(urkiola.sp)[,1]
urkiola.y <- coordinates(urkiola.sp)[,2]
# Finally make up ppp object using coordinates, tree names and owin
urkiola.ppp <- ppp(urkiola.x, urkiola.y,
window=urkiola.owin, marks=urkiola.sp$tree)
summary(urkiola.ppp)
## Marked planar point pattern: 1245 points
## Average intensity 0.06564029 points per square unit
##
## Coordinates are given to 1 decimal place
## i.e. rounded to the nearest multiple of 0.1 units
##
## Multitype:
## frequency proportion intensity
## birch 886 0.7116466 0.04671269
## oak 359 0.2883534 0.01892760
##
## Window: polygonal boundary
## single connected closed polygon with 44 vertices
## enclosing rectangle: [0.05, 219.95] x [0.05, 149.95] units
## Window area = 18967 square units
There are 1245 points with an average intensity of 0.0656 points per sq unit.
#par(mar = c(0,0, 0, 0) + 0.1)
plot(split(urkiola.ppp),cex=0.7, pch = "+",main = "Distribution of Trees")
plot(split(urkiola.ppp)$birch,cex=0.7, main = "Distribution of Birch Trees")
plot(split(urkiola.ppp)$oak,cex=0.7, main = "Distribution of Oak Trees")
#layout(matrix(c(1,2), 1, 2, byrow = TRUE), respect = TRUE)
urkiola.ppp.oak = split(urkiola.ppp)$oak
#plot(density(urkiola.ppp.oak, sigma=2))
urkiola.oak.bw = bw.diggle(urkiola.ppp.oak)
plot(density(urkiola.ppp.oak, sigma=urkiola.oak.bw), main = paste("Kernel Density of Birch (Sigma = ", signif(urkiola.oak.bw,2), ")", sep=""))
plot(split(urkiola.ppp)$oak,cex=0.5,pch = "+", add=T,col="green")
urkiola.ppp.birch = split(urkiola.ppp)$birch
#plot(density(urkiola.ppp.birch, sigma=2))
urkiola.birch.bw = bw.diggle(urkiola.ppp.birch)
plot(density(urkiola.ppp.birch, sigma=urkiola.birch.bw), main = paste("Kernel Density of Birch (Sigma = ", signif(urkiola.birch.bw,2), ")", sep=""))
plot(split(urkiola.ppp)$birch,cex=0.5,pch = "+", add=T,col="green")
The kernel density plots of species suggest that the two species do not occur within the park.
urkiola.ppp.oak.kest = Kest(urkiola.ppp.oak)
#plot(urkiola.ppp.oak.kest)
urkiola.ppp.oak.kest.mc = envelope(urkiola.ppp.oak, fun="Kest", nsim = 99, verbose = FALSE)
plot(urkiola.ppp.oak.kest.mc, shade = c("hi","lo"))
Since the observed distribution is above the theoritical distribution, it indicates clustering and the distribution is not spatially random.
summary(urkiola.ppp.oak.kest.mc)
## Pointwise critical envelopes for K(r)
## and observed value for 'urkiola.ppp.oak'
## Obtained from 99 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/100 = 0.02
## Data: urkiola.ppp.oak
The summary statistics shows that significance level of Monte Carlo test is at 2%.
urkiola.ppp.birch.kest = Kest(urkiola.ppp.birch)
#plot(urkiola.ppp.birch.kest)
urkiola.ppp.birch.kest.mc = envelope(urkiola.ppp.birch, fun="Kest", nsim = 99, verbose = FALSE)
plot(urkiola.ppp.birch.kest.mc, shade = c("hi","lo"))
Since the observed distribution is slightly above the theoritical distribution, it indicates some clustering and the distribution is not exactly spatially random. Birch Trees have more randomness than Oak trees, when compared to previous results.
summary(urkiola.ppp.birch.kest.mc)
## Pointwise critical envelopes for K(r)
## and observed value for 'urkiola.ppp.birch'
## Obtained from 99 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/100 = 0.02
## Data: urkiola.ppp.birch
The summary statistics shows that significance level of Monte Carlo test is at 2%.
urkiola.kc = envelope(urkiola.ppp, Kcross, i="oak", j="birch", nsim=99,verbose=FALSE)
plot(urkiola.kc)
Since the observed curve lies within the envelope, the combined distribution is random. i.e. there is no correlation.