Description Usage Arguments Value See Also Examples

A function for advancing the state of a Lotka-Volterra model by calling some C code implementing the Gillespie algorithm. The function can be used in conjunction with other functions (such as `simTs`

) for simulating realisations of Lotka-Volterra models. Should be functionally identical to the function obtained by `data(spnModels)`

, `stepLV=StepGillespie(LV)`

, but much faster.

1 |

`x0` |
A vector representing the state of the system at the initial time, |

`t0` |
The time corresponding to the initial state, |

`deltat` |
The time in advance of the initial time at which the new state is required. |

`th` |
A vector of length 3 representing the rate constants associated with the 3 LV reactions. Defaults to |

A 2-vector representing the new state of the LV system.

`StepGillespie`

, `spnModels`

, `simTs`

, `simSample`

1 2 3 4 5 6 7 8 9 10 11 12 | ```
# load the LV model
data(spnModels)
# create a stepping function
stepLV = StepGillespie(LV)
# step the function
print(stepLV(c(x1=50,x2=100),0,1))
# simulate a realisation of the process and plot it
out = simTs(c(x1=50,x2=100),0,100,0.1,stepLV)
plot(out)
# now use "stepLVc" instead...
out = simTs(c(x1=50,x2=100),0,100,0.1,stepLVc)
plot(out)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.