if (FALSE) {
# Get the data
data(lansing)
# Split the multivariate pp in their individual components
lansing.sp<-split(lansing)
# Define the sequence of r's at which estimate K(r)
r<- seq(0,0.25,le=101)
# Define different standard deviations for the Gaussian kernel
# to estimate different intensity surfaces
sigmas<- seq(0.1,1,by=0.05)
# Note that lansing is defined in a (0,1) x (0,1) window and this affects
# the election of r and sigma values
# Fit 40 models (1 Poisson, 1 Poisson cluster, 19 inhomogeneous Poisson
# and 19 inhomogeneous Poisson cluster) to maple and select the better ones
maple.model <- select.model2(lansing.sp$maple, sigmas=sigmas, r=r)
# show the AICc value and the fitted parameters for the best model in each class
maple.model
# Draw the empirical and theoretical models to visually asses the fitting.
# P = Poisson; HPP= heterogeneous (i.e. inhomogeneous) Poisson;
# PC = Poisson cluster; HPC=heterogeneous (i.e. inhomogeneous) Poisson cluster
plot(maple.model)
# Compute and plot envelopes for the K function according to the best fitted model.
maple.env <- envelope(maple.model, nsim=19)
plot(maple.env, sqrt(./pi)-r~r, legend=F)
# simulate 10 point patterns according to the best fitted model
maple.simu <- simulate(maple.model, nsim=10)
maple.simu
# FIt and select models to all species
lansing.models<-lapply(lansing.sp, function(x) select.model2(x, sigmas=sigmas, r=r))
lapply(lansing.models, function(x) x)
}
Run the code above in your browser using DataLab