| make_restart_point | R Documentation |
netsim Object with tergmLiteExtract the elements required for re-initializing a netsim simulation from
a completed simulation. This function also resets the Unique IDs and Time
values to reduce the size of the simulation. This function only works for
simulations where control$tergmLite = TRUE
make_restart_point(sim_obj, time_attrs, sim_num = 1, keep_steps = 1)
sim_obj |
a |
time_attrs |
a |
sim_num |
the number of the simulation to extract from the |
keep_steps |
The number of simulation steps to keep from the previous run. By default only keep one but more is possible if some back-history is wanted. |
The restart point created always contains a single simulation and drops the
attr.history, the raw.records and stats from the initial simulation.
The epi trackers, cumulative edgelists, transmission matrix and nwstats are
truncated to only contain the last keep_steps entries.
Warning: the time_attrs argument is mandatory. Almost all simulation worth
restarting have such attributes (e.g. time.of.hiv.infection). If no such
argument exists, passing c() will allow the function to run while ensuring
that this was done on purpose.
When restarting from the output of this function, it is suggested to express
the time steps in a relative maner in control.net:
control.net( start = restart_point$control$nsteps + 1), nsteps = restart_point$control$nsteps + 1 + 104) )
a trimed netsim object with only one simulation that is ready to be
used as a restart point.
## Not run:
# With pre-existing `sim`, `param` and `init` object (see `netsim`)
# List all attributes that store a time step
time_attrs <- c(
"inf.time",
"stage.time",
"aids.time",
"prep.start.last"
)
# Make a restart point a re-run for 10 more timesteps
x <- make_restart_point(sim, time_attrs, sim_num = 1, keep_steps = 1)
control <- control_msm(
start = x$control$nsteps + 1,
nsteps = x$control$nsteps + 1 + 10
)
sim <- netsim(x, param, init, control)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.