Description Usage Arguments Value See Also Examples
This function acts as a simple wrapper for lsoda, allowing for multiple parameter sets and
initial conditions. It also allows lsoda
to be used within the biddmodellingcourse framework.
1 2 |
model |
A model formated as required by |
inits |
The initial state (states) of the model. Can either be supplied as a named vector or as a matrix with each row representing a parameter. |
params |
A named vector or matrix of parameters. The matrix must have a row for each parameter and if |
times |
A numeric vector of the times for which explict model estimates are required, this does not effect the timestep used by the solver |
as.data.frame |
A logical (defaults to |
... |
Additional arguements to pass to |
A dataframe or lsoda object containing a single or multiple model trajectories
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Intialise
N = 100000
I_0 = 1
S_0 = N - I_0
R_0 = 1.1
beta = R_0
##Time for model to run over
tbegin = 0
tend = 50
times <- seq(tbegin, tend, 1)
##Vectorise input
parameters <- as.matrix(c(beta = beta))
inits <- as.matrix(c(S = S_0, I = I_0))
solve_ode(model = SI_ode, inits, parameters, times, as.data.frame = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.