Make a function closure to implement a first order mean-field ODE approximation for a SPN.

step_ODE(S, Sout, haz, method = "lsoda")

Arguments

S

a stoichiometry Matrix-class object

Sout

an optional matrix to track of event firings. In the deterministic case it will return the rate of that event at the end of the time step

haz

a list of hazard functions

method

a character giving the type of numerical integrator used, the default is "lsoda"

Value

function closure for use in sim_trajectory_R or sim_trajectory_CSV

Details

This method is equivalent to considering the ODEs describing the time evolution of the mean trajectory (first moment) and setting all higher order moments which appear on the right hand side to zero.

The solvers used within can be found in the deSolve package, see ode. For inhomogeneous systems, consider using the "rk4" method to avoid excessive integration times.

The stoichiometry matrix (S) is generated in spn_S.

The list of hazards (haz) come from spn_hazards.

For other samplers, see: step_CLE, step_PTS, step_DM