| simulate.om | R Documentation |
Re-simulates probabilities and occurrence indicators
from a fitted om or omg model. The latent ETS is
simulated via the shared C++ kernel (the same one
simulate.adam uses), the latent series is mapped to a
probability via omLinkFunction (or omgLinkFunction
for omg), and a binomial draw with that probability gives
the 0/1 occurrence series.
## S3 method for class 'om'
simulate(object, nsim = 1, seed = NULL, obs = nobs(object),
...)
## S3 method for class 'omg'
simulate(object, nsim = 1, seed = NULL, obs = nobs(object),
...)
object |
An object of class |
nsim |
Number of simulated series to draw. |
seed |
Optional integer; forwarded to |
obs |
Number of observations per simulated series. Defaults to the in-sample length. |
... |
Currently unused; kept for forward compatibility. |
print() on the returned object dispatches to
print.oes.sim via the inherited "oes.sim" class.
An S3 list of class c("om.sim","oes.sim","smooth.sim")
(or c("omg.sim","oes.sim","smooth.sim") for omg)
with fields:
$probabilitySimulated probability series of
shape (obs, nsim) – the equivalent of
sim.oes()'s $probability output.
$data0/1 occurrence indicators of shape
(obs, nsim), drawn via rbinom with the
simulated probability.
$states, $residualsLatent state cube and the errors used internally.
$model, $occurrenceIdentifiers carried over from the fit.
$latentPre-link state-space output –
internal, used by simulate.omg to combine sub-models.
## Not run:
set.seed(7)
y <- rbinom(120, 1, prob=0.3 + 0.005*(1:120))
m <- om(y, model="MNN", occurrence="odds-ratio", silent=TRUE)
sim <- simulate(m, nsim=5, seed=42)
range(sim$probability)
table(sim$data)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.