Description Usage Arguments Details Value See Also Examples
Parse custom model using SimInf
style markup.
Does not have full functionality of mparse
. Currently only supports
simulations on a single node.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
transitions |
character vector containing transitions on the form |
compartments |
contains the names of the involved compartments, for
example, |
pars |
a |
obsProcess |
|
addVars |
a |
stopCrit |
A |
tspan |
A |
incidence |
A |
afterTstar |
A |
PF |
A |
runFromR |
|
Uses a SimInf
style markup to create compartmental state-space
written using Rcpp
. A helper run
function exists to compile
and run the model. Another helper function, compileRcpp
,
can compile the model to produce a function that can be run directly from R,
or compiled into an external pointer (using the RcppXPtrUtils
package).
An object of class SimBIID_model
, which is essentially a list
containing elements:
code: parsed code to compile;
transitions: copy of transitions
argument;
compartments: copy of compartments
argument;
pars: copy of pars
argument;
obsProcess: copy of obsProcess
argument;
stopCrit: copy of stopCrit
argument;
addVars: copy of addVars
argument;
tspan: copy of tspan
argument;
incidence: copy of incidence
argument;
afterTstar: copy of afterTstar
argument;
PF: copy of PF
argument;
runFromR: copy of runFromR
argument.
This can be compiled into an XPtr
or function
object
using compileRcpp()
.
run
, compileRcpp
, print.SimBIID_model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## set up SIR simulation model
transitions <- c(
"S -> beta * S * I -> I",
"I -> gamma * I -> R"
)
compartments <- c("S", "I", "R")
pars <- c("beta", "gamma")
model <- mparseRcpp(
transitions = transitions,
compartments = compartments,
pars = pars
)
## compile and run model
sims <- run(
model = model,
pars = c(beta = 0.001, gamma = 0.1),
tstart = 0,
tstop = 100,
u = c(S = 119, I = 1, R = 0)
)
sims
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.