The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The Linear Chain System consists of M chain reactions with M+1 species as follows:
S_1 --c1--> S_2
S_2 --c2--> S_3
...
S_M --cM--> S_(M+1)
Load package
library(GillespieSSA)
Define parameters
<- c(c = 1) # Rate parameter
parms <- 50 # Number of chain reactions
M <- "Linear Chain System" # Simulation name
simName <- 5 # Final time tf
Define initial state vector
<- c(1000, rep(0, M))
x0 names(x0) <- paste0("x", seq_len(M+1))
Define state-change matrix
<- matrix(rep(0, M * (M+1)), ncol = M)
nu cbind(seq_len(M), seq_len(M))] <- -1
nu[cbind(seq_len(M)+1, seq_len(M))] <- 1 nu[
Define propensity functions
<- paste0("c*x", seq_len(M)) a
Run simulations with the Direct method
set.seed(1)
<- ssa(
out x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = ssa.d(),
simName = simName,
verbose = FALSE,
consoleInterval = 1
) ssa.plot(out, show.title = TRUE, show.legend = FALSE)
Run simulations with the Explict tau-leap method
set.seed(1)
<- ssa(
out x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = ssa.etl(tau = .1),
simName = simName,
verbose = FALSE,
consoleInterval = 1
) ssa.plot(out, show.title = TRUE, show.legend = FALSE)
Run simulations with the Binomial tau-leap method
set.seed(1)
<- ssa(
out x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = ssa.btl(f = 50),
simName = simName,
verbose = FALSE,
consoleInterval = 1
) ssa.plot(out, show.title = TRUE, show.legend = FALSE)
Run simulations with the Optimized tau-leap method
set.seed(1)
<- ssa(
out x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = ssa.otl(),
simName = simName,
verbose = FALSE,
consoleInterval = 1
) ssa.plot(out, show.title = TRUE, show.legend = FALSE)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.