# NOT RUN {
if(require("spatstat", quietly=TRUE)) {
# Example of tropical rain forest trees
data(bei)
fullmodel <- ~ grad
reducedmodel <- ~ 1
fitppm <- function(X, model, covariates) {
ppm(X, model, covariates=covariates)
}
# }
# NOT RUN {
# }
# NOT RUN {
nsim <- 19 # Increase nsim for serious analysis!
res <- GET.spatialF(bei, fullmodel, reducedmodel, fitppm, bei.extra, nsim)
# }
# NOT RUN {
plot(res$F)
plot(res$S)
# }
# NOT RUN {
# Example of forest fires
data("clmfires")
# Choose the locations of the lightnings in years 2004-2007:
pp.lightning <- unmark(subset(clmfires, cause == "lightning" &
date >= "2004-01-01" & date < "2008-01-01"))
covariates <- clmfires.extra$clmcov100
covariates$forest <- covariates$landuse == "conifer" | covariates$landuse == "denseforest" |
covariates$landuse == "mixedforest"
fullmodel <- ~ elevation + landuse
reducedmodel <- ~ landuse
nsim <- 19 # Increase nsim for serious analysis!
res <- GET.spatialF(pp.lightning, fullmodel, reducedmodel, fitppm, covariates, nsim)
plot(res$F)
plot(res$S)
# Examples of the fitfun functions for clustered and regular processes
# fitfun for the log Gaussian Cox Process with exponential covariance function
fitLGCPexp <- function(X, model, covariates) {
kppm(X, model, clusters="LGCP", model="exponential", covariates=covariates)
}
# fitfun for the hardcore process with hardcore radius 0.01
fitHardcore <- function(X, model, covariates) {
ppm(X, model, interaction=Hardcore(0.01), covariates = covariates)
}
# }
# NOT RUN {
}
# }
Run the code above in your browser using DataLab