Skip to contents

Adapt a Compartmental model to a simulation engine. Currently TMB is the only simulation engine.

Usage

Simulators(model)

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 to model$state_labels().

  • flow: Named numerical vector giving the default initial value of the flow vector. The names must be equal to model$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 in model$other_labels(). See MatsList 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 in model$other_labels(). See MatsList for details.

  • .dimnames: Advanced and often not necessary. See MatsList for details.