simEpidataCS simulates events of a self-exiciting
spatio-temporal point process of the "twinstim" class.
Simulation works via Ogata's modified thinning of the conditional
intensity as described in Meyer et al. (2012). The simulate method for objects of class
"twinstim" simulates new epidemic data using the model and
the parameter estimates of the fitted object.
simEpidataCS(endemic, epidemic, siaf, tiaf, qmatrix, rmarks,
events, stgrid, tiles, beta0, beta, gamma, siafpars, tiafpars,
t0 = stgrid$start[1], T = tail(stgrid$stop,1), nEvents = 1e5, nCub,
W = NULL, trace = 5, nCircle2Poly = 32, gmax = NULL, .allocate = 500,
.skipChecks = FALSE, .onlyEvents = FALSE,...)## S3 method for class 'twinstim':
simulate(object, nsim = 1, seed = NULL, data, tiles,
rmarks = NULL, t0 = NULL, T = NULL, nEvents = 1e5, nCub,
W = NULL, trace = FALSE, nCircle2Poly = 32, gmax = NULL,
.allocate = 500, simplify = TRUE, ...)
twinstim. Note that type-specific endemic
intercepts are specified by beta0 here, not by the term
(1|type).twinstim. Marks appearing in this formula must
be returned by the generating function rmarks.twinstim.
In addition to what is required for fitting with twinstim,
the siaf specification must also contain the element
simulate, a function which dtiaf.constant or tiaf.exponential. See also
twepidataCS. Note that this square
matrix and its dimnames determine the number and names of the
different event types. In the simplest case, there is only a single
type of evendata.frame of marks (named
according to the variables in epidemic) for an event at this
point. This includes the columns eps.s NULL or missing (default) in case of an empty prehistory,
or a SpatialPointsDataFrame containing events of the
prehistory (-Inf;t0] of the process (having thas.epidataCS. Simulation only works inside the spatial
and temporal range of stgrid.SpatialPolygons with row.names equal
to the tile names in stgrid and having the same
proj4string as events and W. This is necessary
twinstim.
beta and gamma must be given in the
same order as they appear in endemic and epidemic,
respectively. beta0 is eit0] are regarded as part of the
prehistory $H_0$ of the process. The time point t0 must be an element
of stgrid$start. For simEpidataCS, by default, and
alsnEvents events up to time T,
then stop. For simEpidataCS, by default, and also if
T=NULL, T equals the last stop time in stgrid
(it cannot be greater) and <as.epidataCS. Must have the same
proj4string as events and tiles. If not
specified (NULL), W is generated
automaticallycated. For the
simulate.twinstim method, trace currently only applies
to the first of the nsim simul.allocate rows."twinstim"."epidataCS") to simulate. Defaults to 1 when the
result is a simple object inheriting from class
"simEpidataCS" (as if simEpidataCSNULL), the state of the random
generator is not changed and the value of .Random.seed prior to
simulation is stor"epidataCS", usually the one to which the
"twinstim" object was fitted.simplify = TRUE
(default) if nsim is large. This saves space and computation time,
because for each simulated epidemic only the events component is
saved. All ottwinstim.as.epidataCS.tiaf$g can attain. If NULL, then it is assumed as the
maximum value of the type-specific values at 0, i.e.
max(tiaf$g(rep.int(0,nTypes), tiafpars, 1:nTypes))simEpidataCS returns a simulated epidemic of class
"simEpidataCS", which enhances the class
"epidataCS" by the following additional components known from
objects of class "twinstim":
timeRange, formula, coefficients, npars,
call, runtime. The simulate.twinstim method has some additional
attributes set on its result:
call, seed, simplified, and runtime
with their obvious meanings. Furthermore, if
nsim > 1, it returns an object of class
"simEpidataCSlist", the form of which depends on the value of
simplify: if simplify = FALSE, then the return value is
just a list of sequential simulations, each of class
"simEpidataCS". However, if simplify = TRUE, then the
sequential simulations share all components but the simulated
events, i.e. the result is a list with the same components as
a single object of class "simEpidataCS", but with events
replaced by an eventsList containing the events returned
by each of the simulations.
Meyer, S. (2010):
Spatio-Temporal Infectious Disease Epidemiology based on Point Processes.
Master's Thesis, Ludwig-Maximilians-Universit
plot.epidataCS and animate.epidataCS
methods for plotting and animating continuous-space epidemic data,
respectively, which also work for simulated epidemics (by inheritance).
Function twinstim for fitting
spatio-temporal conditional intensity models to epidemic data.