require(spatstat)
data(urkiola)
#####################
## univariate example
# get univariate pp
I.ppp <- split.ppp(urkiola)$birch
# estimate inhomogeneous intensity function
I.lam <- predict (ppm(I.ppp, ~polynom(x,y,2)), type="trend", ngrid=200)
# Compute and plot envelopes to Kinhom, simulating from an Inhomogeneous
# Poisson Process:
I2.env <- envelope( I.ppp,Kinhom, lambda=I.lam, correction="trans",
nsim=99, simulate=expression(rpoispp(I.lam)))
plot(I2.env, sqrt(./pi)-r~r)
# It seems that there is short scale clustering; let's fit an Inhomogeneous
# Poisson Cluster Process:
I.ki <- ipc.estK(mippp=I.ppp, lambda=I.lam, correction="trans")
# Compute and plot envelopes to Kinhom, simulating from the fitted IPCP:
Ipc.env <- Ki(I.ki, correction="trans", nsim=99, ngrid=200)
plot (Ipc.env)
#####################
## bivariate example: test independence between birch and quercus in Urkiola
J.ppp <- split.ppp(urkiola)$oak
# We want to simulate oak from a homogeneous Poisson model:
J.ppm <- ppm(J.ppp, trend=~1, interaction=Poisson() )
IJ.env <- Kci (mod1=I.ki, nsim=99, mod2=J.ppm)
plot(IJ.env, type=12)
plot(IJ.env, type=21)
Run the code above in your browser using DataLab