View source: R/simulate.scampr.R
simulate.scampr | R Documentation |
Simulates point patterns from a specified scampr model.
## S3 method for class 'scampr'
simulate(
object,
nsim = 1,
seed = NULL,
...,
domain.data,
rcoef.density = c("posterior", "prior"),
which.intensity = c("expected", "sample"),
return.type = c("data.frame", "ppp"),
nsurv,
log.expected = T
)
object |
a scampr model |
nsim |
number of point patterns to simulate. Defaults to 1. |
seed |
an integer for setting the random seed. |
... |
NA |
domain.data |
optionally, a data frame of point locations that adequately cover the domain of interest, as well as, predictors involved in the model. If missing model quadrature is used. NOTE: if model quadrature is used and is an inadequate cover of the domain, simulation may be effected as interpolated variables will contain many NA values. |
rcoef.density |
a character string indicating the probability density of the random effects to draw from. |
which.intensity |
a character string, one of 'expected' or 'sample', indicating whether to simulate from the expected intensity (with respect to 'type' and 'rcoef.density') or from a randomly sampled intensity (with respect to 'rcoef.density') respectively. This will work in conjunction with 'type' (changes expectation) and 'rcoef.density' (N(0,prior_var) or N(posterior_mean, posterior_var)). Toggling this depends on the use of simulation, e.g. 'expected' may be useful in validating a model while 'sample' may be useful for making predictions. |
return.type |
a character string, one of 'data.frame' or 'ppp', indicating the object type of the simulation to be returned. Default is data frame for use in scampr models. |
nsurv |
an optional integer describing the number of survey sites to be included in the simulated presence/absence data. Only applies to combined data models (popa), if null the survey sites of the original model are used. |
log.expected |
a logical indicating whether to take the expectation of the log-intensity (ignores the variance correction). Only relevant to LGCP models for which |
Depends on return.type. Default is a point pattern object of class 'ppp' from spatstat. Otherwise can be set to return a data.frame describing the point pattern (with corresponding quadrature as an attribute). If nsim > 1 then returned as a list of either 'return.type'.
dat <- scampr::gorillas
dat$elev <- scale(dat$elevation)
mod <- scampr(pres ~ elev, dat, include.sre = F)
## Not run: pp <- simulate(mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.