# Build a multivariate point pattern where maple is simulated according to a Poisson process
# and where all the other species are keep fixed in their original coordinates.
# (The warnings are because in the original lansing point pattern there is a dupplicated
# point)
data(lansing)
ipsim(pp=lansing, mimark="maple")
# Build a multivariate point pattern where maple is simulated according to an Inhomogeneous
# Poisson process from an intensity surface estimated "on the fly" with a Gaussian kernel with
# sd = "sigma", and where all the other species are keep fixed in their original coordinates.
ipsim(pp=lansing, mimark="maple", sigma=0.1)
# Build a multivariate point pattern where maple is simulated according to an Inhomogeneous
# Poisson process from a predefined intensity surface "lambda" and where all the other
# species are keep fixed in their original coordinates. "Lambda" is an im object resulting
# from density.ppp(), from predict.ppm() or converted from any other rasterized image.
maple.lambda<- density.ppp(lansing[lansing$marks=="maple"])
ipsim(pp=lansing, mimark="maple", lambda=maple.lambda)
# Build a list of 19 multivariate point pattern where maple is simulated according to an
# Inhomogeneous Poisson process from a predefined intensity surface "lambda" and where all
# the other species are keep fixed in their original coordinates. "Lambda" is an im object
# resulting from density.ppp(), # from predict.ppm() or converted from any other rasterized
# image.
# Estimate the intensity of maple
maple.lambda<- density(unmark(lansing[lansing$marks=="maple"]))
# first simulate the individual maple patterns
maple.sim<- simulador2(mimark="maple", milambda=maple.lambda, nsim=19)
# Then, mix the simulated maple patterns with the rest of the multivariate pattern
# (which remains "fixed")
multi.maple.sim<- ipsimlist(pp=lansing, mimark="maple", listsim=maple.sim)
## Use of multifocalsimulator() ##
# The same but in a single step with multifocalsimulator(): Build a list of 19 multivariate
# point pattern where maple is simulated according to an Inhomogeneous Poisson process
# from a predefined intensity surface "lambda" and where all the other species are keep
# fixed in their original coordinates. "Lambda" is an im object resulting from density.ppp(),
# from predict.ppm() or converted from any other rasterized image.
# Estimate the intensity of maple
maple.lambda<- density(unmark(lansing[lansing$marks=="maple"]))
# get 99 simulated multivariate point patterns where only maple varies,
# according to an inhomogeneous Poisson process
multi.maple.sim <- multifocalsimulator(lansing, "maple", nsim=99,
simulate=expression(rpoispp(maple.lambda)))
if (FALSE) {
# Use the simulated multivariate patterns to compute envelopes for the ISAR against
# a null model of IPP for maple
isar.maple.env<- envelope(lansing, fun=isar, mimark="maple", nsim=99, savefuns=TRUE,
r=seq(0.01, 0.25, le=100), simulate=multi.maple.sim)
plot( isar.maple.env)
# Use multifocalsimulator() to compute envelopes for the ISAR against a null model of
# Poisson cluster for maple.
# First, adjust a Poisson Cluster process to maple
require(ecespa)
maple.pc<- ipc.estK(unmark(lansing[lansing$marks=="maple"]))
# generate list of simulated multivariate partterns (all other species fixed and maple
# simulated according to the adjusted PC process):
maple.pc.sim<-multifocalsimulator(pp=lansing, mimark="maple", nsim=99,nmin=NULL,
simulate=expression(rIPCP(maple.pc)))
# compute envelopes
isar.maple.pc.env<- envelope(lansing, fun=isar, mimark="maple", nsim=99, savefuns=TRUE,
simulate=maple.pc.sim, r=seq(0.01, 0.25, le=100))
plot( isar.maple.pc.env)
# Compute envelopes for the IFDAR against a null model of Poisson cluster for sp_44 in
# San Francisco forest.
data(SF)
data(SFtraits)
# first, get the original point pattern but with marks only for the species (i.e., dsicard
# the data.frame of marks and keep only the vector of species names)
SFsp<- unmark(SF)
marks(SFsp)<- SF$marks$species
# second, adjust a PCP to sp_44
sp_44.pc<- ipc.estK(unmark(SFsp[SFsp$marks=="sp_44"]))
# third, generate multivariate simulated patterns with only sp_44 varying according
# to the adjusted PCP
sp_44.pc.sim<-multifocalsimulator(pp=SFsp, mimark="sp_44",nsim=99,nmin=NULL,
simulate=expression(rIPCP(sp_44.pc)))
# finally, compute envelopes
ifdar.sp_44.pc.env<- envelope(SFsp, fun=ifdar, mimark="sp_44", traits=SFtraits, r=1:30,
correct.trait.na=TRUE, nsim=99, simulate=sp_44.pc.sim, savefuns=TRUE)
plot( ifdar.sp_44.pc.env)
}
Run the code above in your browser using DataLab