During an SSA simulation, at any infinitesimal time interval, a reaction will occur with a probability defined according to its propensity. If it does, then it will change the state vector according to its effects.
Arguments
- propensity
[character/formula]
A character or formula representation of the propensity function, written in C++.- effect
[named integer vector]
The change in state caused by this reaction.- name
[character]
A name for this reaction (Optional). May only contain characters matching[A-Za-z0-9_]
.
Value
[SSA_reaction]
This object describes a single reaction as part of an SSA simulation. It contains the following member values:
r[["propensity"]]
: The propensity function as a character.r[["effect"]]
: The change in state caused by this reaction.r[["name"]]
: The name of the reaction,NA_character_
if no name was provided.
Details
It is possible to use 'buffer' values in order to speed up the computation
of the propensity functions. For instance, instead of "(c3 * s1) / (1 + c3 * c1)"
,
it is possible to write "buf = c3 * s1; buf / (buf + 1)"
instead.
Examples
# propensity effect
reaction(~ c1 * s1, c(s1 = -1))
#> Reaction:
#> - Propensity: c1 * s1
#> - Effects: s1: -1
reaction("c2 * s1 * s1", c(s1 = -2, s2 = +1))
#> Reaction:
#> - Propensity: c2 * s1 * s1
#> - Effects: s1: -2, s2: +1
reaction("buf = c3 * s1; buf / (buf + 1)", c(s1 = +2))
#> Reaction:
#> - Propensity: buf = c3 * s1; buf / (buf + 1)
#> - Effects: s1: +2