| multSim | R Documentation |
Perform simulations of a PDMP with different seeds and optionally save the results in a rda file.
multSim(obj, seeds, filename = NULL, ms = NULL, allowDeletion = FALSE, ...)
obj |
object of class |
seeds |
integer vector with seeds that shall be simulated (different seeds lead to different simulated trajectories) |
filename |
string which indicates the path where to save the result,
i. e. "NameOfFile.rda". In case of a break or an error, already simulated
seeds will still be saved there. If |
ms |
object of class |
allowDeletion |
logical. If true, seeds with existing simulations
stored in |
... |
additional parameters for method |
The returned s3 class multSim contains 4 different elements:
model containing the pdmpModel obj,
seeds containing the integer vector seeds,
a list outputList containing the simulation results,
i.e. outputList[[i]] = sim(model, seed = seeds[i]),
a list timeList containing the time needed for every simulation,
i.e. timeList[[i]] = system.time(sim(model, seed = seeds[i]))
If an object ms of class multSim is given as parameter, method
multSim will only simulate the seeds that are not simulated yet.
You can control if seeds that are already simulated and stored in ms
but do not appear in the parameter seeds should be deleted or not.
This is done via the parameter allowDeletion.
If the time slot of obj has a larger end value than the
pdmpModel stored in ms, i.e. times(obj)["to"] >
times(ms$model)["to"], all existing simulations will be expanded to
the larger end value.
Slot obj@out is not affected by multSim.
object of class multSim containing simulations for all
given seeds
There are several plot methods for objects of class multSim:
plot, plotSeeds, plotTimes,
plotStats, hist and density.
data("simplePdmp")
m1 <- multSim(simplePdmp, seeds = 1:10)
plot(m1$outputList[[1]])
# expand times:
times(simplePdmp)["to"] <- 20
m2 <- multSim(simplePdmp, seeds = 1:15, ms = m1)
plot(m2$outputList[[15]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.