GillespieSSA:
Gillespie’s Stochastic Simulation Algorithm (SSA)GillespieSSA provides a simple to use, intuitive, and extensible interface to several stochastic simulation algorithms for generating simulated trajectories of finite population continuous-time model. Currently it implements Gillespie’s exact stochastic simulation algorithm (Direct method) and several approximate methods (Explicit tau-leap, Binomial tau-leap, and Optimized tau-leap).
The package also contains a library of template models that can be run as demo models and can easily be customized and extended. Currently the following models are included, decaying-dimerization reaction set, linear chain system, logistic growth model, Lotka predator-prey model, Rosenzweig-MacArthur predator-prey model, Kermack-McKendrick SIR model, and a metapopulation SIRS model.
You can install GillespieSSA from CRAN using
install.packages("GillespieSSA")Or, alternatively, you can install the development version of GillespieSSA from GitHub using
devtools::install_github("rcannood/GillespieSSA", build_vignettes = TRUE)The following example models are available:
vignette("decaying_dimer", package="GillespieSSA")vignette("epi_chain", package="GillespieSSA")vignette("linear_chain", package="GillespieSSA")vignette("logistic_growth", package="GillespieSSA")vignette("lotka_predator_prey", package="GillespieSSA")vignette("radioactive_decay", package="GillespieSSA")vignette("rm_predator_prey", package="GillespieSSA")vignette("sir", package="GillespieSSA")Check out news(package = "GillespieSSA") or NEWS.md for a full list of changes.
.t as parameter in the
propensity functions.This release contains a major rewrite of the internal code, to make sure the code is readable and that the algorithm doesn’t continuously update the local environment.
MAJOR CHANGE: Instead of passing "D",
"ETL", "OTL", or "BTL" to
ssa(), it is expected to pass ssa.d(),
ssa.etl(), ssa.otl(), or
ssa.btl(). This cleans up parameter setting clutter in the
ssa() function.
MAJOR CHANGE: Rewrite ssa.*() and
ssa.*.diag() as ssa_step.ssa_*() and
ssa_step_diag.ssa_*() S3 functions.
MAJOR CHANGE: Do not save the current state in the function environment. Instead, simply save it in a local variable.
MAJOR CHANGE: Precompile propensity functions instead of evaluating them as R code at each iteration.
MAJOR CHANGE: Clean up and merge ssa.run(),
ssa.terminate(), ssa.check.args() and
ssa.check.method() into ssa().