50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


GillespieSSA2 (version 0.3.0)

GillespieSSA2: GillespieSSA2: Gillespie's Stochastic Simulation Algorithm for impatient people.

Description

GillespieSSA2 is a fast, scalable, and versatile framework for simulating large systems with Gillespie's Stochastic Simulation Algorithm (SSA). This package is the spiritual successor to the GillespieSSA package originally written by Mario Pineda-Krch.

Arguments

The stochastic simulation algorithm

The stochastic simulation algorithm (SSA) is a procedure for constructing simulated trajectories of finite populations in continuous time. If Xi(t) is the number of individuals in population i (i=1,,N) at time t, the SSA estimates the state vector X(t)(X1(t),,XN(t)), given that the system initially (at time t0) was in state X(t0)=x0.

Reactions are single instantaneous events changing at least one of the populations (e.g. birth, death, movement, collision, predation, infection, etc). These cause the state of the system to change over time.

The SSA procedure samples the time τ to the next reaction Rj (j=1,,M) and updates the system state X(t) accordingly.

Each reaction Rj is characterized mathematically by two quantities; its state-change vector \bmνj and its propensity function aj(x). The state-change vector is defined as \bmνj(ν1j,,νNj), where νij is the change in the number of individuals in population i caused by one reaction of type j. The propensity function is defined as aj(x), where aj(x)dt is the probability that a particular reaction j will occur in the next infinitesimal time interval [t,t+dt].

Contents of this package

  • ssa(): The main entry point for running an SSA simulation.

  • plot_ssa(): A standard visualisation for generating an overview plot fo the output.

  • ssa_exact(), ssa_etl(), ssa_btl(): Different SSA algorithms.

  • ode_em(): An ODE algorithm.

  • compile_reactions(): A function for precompiling the reactions.

Details

GillespieSSA2 has the following added benefits:

  • The whole algorithm is run in Rcpp which results in major speed improvements (>100x). Even your propensity functions (reactions) are being compiled to Rcpp!

  • Parameters and variables have been renamed to make them easier to understand.

  • Many unit tests try to ensure that the code works as intended.

The SSA methods currently implemented are: Exact (ssa_exact()), Explicit tau-leaping (ssa_etl()), and the Binomial tau-leaping (ssa_btl()).

See Also

ssa() for more explanation on how to use GillespieSSA2