Adapt a Compartmental
model to a simulation engine. Currently
TMB is the only simulation engine.
Arguments
- model
A
Compartmental
model.
Value
An object with the following methods.
Methods
$tmb(time_steps
, state, rate
, ....mats_to_save = .mats_to_return
, .mats_to_return = "state"
, .dimnames = list()
, )
Method Arguments
time_steps
: The number of time steps run in each simulation.state
: Named numerical vector giving the default initial value of the state vector. The names must be equal tomodel$state_labels()
.flow
: Named numerical vector giving the default initial value of the flow vector. The names must be equal tomodel$flow_labels()
....
: Named numerical objects that can be coerced to a matrix, giving the matrices required by the model..mats_to_save
: Character vector of names of matrices to save. Defaults to"state"
, which is the state vector. Other useful names include"total_inflow"
(the incidence associated with each state variable) and"total_outflow"
(the total leaving each state variable at each time step). One may also add any variable inmodel$other_labels()
. SeeMatsList
for details..mats_to_return
: Character vector of names of matrices to return. Defaults to"state"
, which is the state vector. Other useful names include"total_inflow"
(the incidence associated with each state variable) and"total_outflow"
(the total leaving each state variable at each time step). One may also add any variable inmodel$other_labels()
. SeeMatsList
for details..dimnames
: Advanced and often not necessary. SeeMatsList
for details.