Using the structural (topological) SPN model as well as parameters in the cube and params objects, generate a list (of length |v|) of hazards, each implemented as a function closure.

spn_hazards(
  spn_P,
  spn_T,
  cube,
  params,
  type = "life",
  log_dd = TRUE,
  exact = TRUE,
  tol = 1e-12,
  verbose = TRUE
)

Arguments

spn_P

the set of places (P) (see details)

spn_T

the set of transitions (T) (see details)

cube

an inheritance cube from the MGDrivE package (e.g. cubeMendelian)

params

a named list of parameters (see details)

type

string indicating type of hazards, one of; "life", "SIS", or "SEIR"

log_dd

if TRUE, use logistic (carrying capacity) density dependent hazards, if FALSE use Lotka-Volterra density dependent hazards for larval mortality

exact

boolean, make exact (integer input) hazards? Default is TRUE

tol

if exact=FALSE, the value of hazard below which it is clipped to 0

verbose

display a progress bar when making hazards?

Value

list of length 2: hazards is a list of named closures for every state transition in the model, flag is a boolean indicating exact or approximate

Details

If these hazards will be used in a continuous approximation algorithm, such as an ODE method (step_ODE) or Gillespie's Direct Method (step_DM), it is recommended to use exact=FALSE. If the hazards will be used in an integer state space method, such as tau-leaping (step_PTS) or Chemical Langevin (step_CLE) methods, it is recommended to use exact=TRUE.

The places (spn_P) object is generated from one of the following: spn_P_lifecycle_node, spn_P_lifecycle_network, spn_P_epiSIS_node, spn_P_epiSIS_network, spn_P_epiSEIR_node, or spn_P_epiSEIR_network.

The set of transitions (spn_T) is generated from one of the following: spn_T_lifecycle_node, spn_T_lifecycle_network, spn_T_epiSIS_node, spn_T_epiSIS_network, spn_T_epiSEIR_node, spn_T_epiSEIR_network.

The params objected is generated from either equilibrium_lifeycle or equilibrium_SEI_SIS; it is the "params" object in the return list. The equilibrium function used must match the type parameter.

The type parameter indicates what type of simulation is being run. It is one of: "life", "SIS", or "SEIR". This must match the params object supplied.

Use of this function is demonstrated in many vignettes, browseVignettes(package = "MGDrivE2")