date()
## [1] "Mon Mar 18 11:58:41 2013"
Using the ants data set
1.Plot the nest locations.
suppressWarnings(require(spatstat, quietly = TRUE))
## This is mgcv 1.7-18. For overview type 'help("mgcv-package")'.
## deldir 0.0-21
## spatstat 1.29-0 Type 'help(spatstat)' for an overview of spatstat
## 'latest.news()' for news on latest version 'licence.polygons()' for
## licence information on polygon calculations
data(ants)
AN = ants
plot(AN)
## Cataglyphis Messor
## 1 2
summary(AN)
## Marked planar point pattern: 97 points
## Average intensity 0.000226 points per square unit (one unit = 0.5 feet)
## Multitype:
## frequency proportion intensity
## Cataglyphis 29 0.299 6.76e-05
## Messor 68 0.701 1.59e-04
##
## Window: polygonal boundary
## single connected closed polygon with 11 vertices
## enclosing rectangle: [-25, 803]x[-49, 717]units
## Window area = 428922 square units
## Unit of length: 0.5 feet
2.Create separate ppp objects for the two types of ants.
temp = split(AN)
CA = temp$Cataglyphis
ME = temp$Messor
class(CA)
## [1] "ppp"
class(ME)
## [1] "ppp"
3.Plot the G function for the Cataglyphis and Messor ants separately. What do you find?
G_CA = Gest(CA)
plot(G_CA, main = "G function for the Cataglyphis ants")
## lty col key label meaning
## km 1 1 km hat(G)[km](r) Kaplan-Meier estimate of G(r)
## rs 2 2 rs hat(G)[bord](r) border corrected estimate of G(r)
## han 3 3 han hat(G)[han](r) Hanisch estimate of G(r)
## theo 4 4 theo G[pois](r) theoretical Poisson G(r)
G_ME = Gest(ME)
plot(G_ME, main = "G function for the Messor ants")
## lty col key label meaning
## km 1 1 km hat(G)[km](r) Kaplan-Meier estimate of G(r)
## rs 2 2 rs hat(G)[bord](r) border corrected estimate of G(r)
## han 3 3 han hat(G)[han](r) Hanisch estimate of G(r)
## theo 4 4 theo G[pois](r) theoretical Poisson G(r)
There are fewer Cataglyphis ants near other Cataglyphis ants than is expected; Similarly, there are fewer Messor ants near other Messor ants than is expected.
4.Plot the Kcross function and describe the evidence for inter-species clustering.
plot(Kcross(AN, "Cataglyphis", "Messor"))
## lty col key
## iso 1 1 iso
## trans 2 2 trans
## border 3 3 border
## theo 4 4 theo
## label
## iso hat(K[list(Cataglyphis, Messor)]^{ iso})(r)
## trans hat(K[list(Cataglyphis, Messor)]^{ trans})(r)
## border hat(K[list(Cataglyphis, Messor)]^{ bord})(r)
## theo { K[list(Cataglyphis, Messor)]^{ pois }}(r)
## meaning
## iso Ripley isotropic correction estimate of Kcross["Cataglyphis", "Messor"](r)
## trans translation-corrected estimate of Kcross["Cataglyphis", "Messor"](r)
## border border-corrected estimate of Kcross["Cataglyphis", "Messor"](r)
## theo theoretical Poisson Kcross["Cataglyphis", "Messor"](r)
With distance increasing, there are more Cataglyphis ants in the vicinity of Messor ants than is expected.
5.Create an umarked ppp object and model the nests using a Strauss process with interaction distance of 100 and border correction distance of 100. Interpret the first order term and interaction parameter.
AN_unm = unmark(AN)
AN_unm.model = ppm(AN_unm, trend = ~1, interaction = Strauss(r = 100), rbord = 100)
AN_unm.model
## Stationary Strauss process
##
## First order term:
## beta
## 0.0009962
##
## Interaction: Strauss process
## interaction distance: 100
## Fitted interaction parameter gamma: 0.8189
##
## Relevant coefficients:
## Interaction
## -0.1998
##
## For standard errors, type coef(summary(x))
The first-order term is the intensity of the proposal nests (0.000996). It is larger than that of the actual nests (0.000226). It means that there are fewer nests in the vicinity of other nests than is expected.
The interaction parameter is 0.8189. It is less than one indicating an inhibition process.