mparseRcpp | R Documentation |
SimInf
style markupParse custom model using SimInf
style markup.
Does not have full functionality of mparse
. Currently only supports
simulations on a single node.
mparseRcpp( transitions = NULL, compartments = NULL, pars = NULL, obsProcess = NULL, addVars = NULL, stopCrit = NULL, tspan = FALSE, incidence = FALSE, afterTstar = NULL, PF = FALSE, runFromR = TRUE )
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
## 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.