data(SF)
data(SFphylotree)
# Discard the size mark and keep the species mark in SF ppp:
sfsp<- ppp(SF$x, SF$y, window=SF$window, marks=SF$marks$species)
# compute phylogenetic distance among species
dphy <- cophenetic(SFphylotree)
# compute and plot PISAR function for sp_44
pisar_44 <- pisar(sfsp, mimark="sp_44", r=1:15, d=dphy)
plot(pisar_44)
if (FALSE) {
# Compute rISAR and plot envelopes for an inhomogeneous Poisson model
# of each species in San Francisco plot
# BEWARE: THIS TAKES QUITE A FEW MINUTES !!!
# Split sfsp point pattern ppp by species
sfsp.sp<- split(sfsp)
# Species with >= 10 individuals
sfsp10 <- sapply(sfsp.sp, function(x) x$n>=10)
#names of those species
nombressf<- names(sfsp10[sfsp10])
# parameters for the simulations, estimation of intensity, etc.
nsim<-199
nmin<-10
sigma <- 8
r<- seq(1,15, by=0.5)
# list to store results
risar.sf<- list()
# start computation
for( sp in nombressf){
print(sp)
# estimate intensity of the focal species
lambda<- density(unmark(sfsp[sfsp$marks==sp]), sigma=sigma, positive=TRUE)
# obtain simulated patterns were all species ecept the focal remain fixed
# and the focal varies according to an inhomomgeneous Poiisson process
simulados<- multifocalsimulator(sfsp, mimark=sp,
simulate=expression(rpoispp(lambda)), nsim=nsim,nmin=nmin)
# compute risar
risar.sf[[sp]] <- envelope(sfsp, risar, mimark=sp, d=dphy, r=r,
simulate=simulados,nsim=nsim, savefuns=T, buffer=0)
}
# plot the results
dev.new(height=7, width=16)
par(mfrow=c(3,9))
for(i in 1:27) plot(risar.sf[[i]], legend=F, main=nombressf[i])
}
Run the code above in your browser using DataLab