Check model elements for compatibility with the population in an epidemic model, returning compatible dummy values when model elements are not applied, and erroring appropriately when model elements are not compatible with the population characteristics.
Usage
.cross_check_intervention(x, population, allowed_targets)
.cross_check_vaccination(x, population, doses)
.cross_check_timedep(x, allowed_targets)
.cross_check_popchange(x, population)
Arguments
- x
Model input to be checked. The expected value of
x
depends on the function:.cross_check_intervention()
: A named list of<intervention>
objects;.cross_check_vaccination()
: A<vaccination>
object;.cross_check_timedep()
: A named list of functions with two arguments,time
andx
, typically returningx
as a function oftime
;.cross_check_popchange()
: A named list with two elements,time
andvalues
, describing the times and values by which the number of susceptibles changes in an epidemic model.
- population
An object of the
population
class, which holds a population contact matrix, a demography vector, and the initial conditions of each demographic group. Seepopulation()
.- allowed_targets
The model components, or infection parameters, that the model input
x
affects.- doses
The expected number of vaccination doses.
Value
.cross_check_intervention()
returns a named list with at least the elements "contacts" describing a<contacts_intervention>
onpopulation
(if this is among the allowed targets), and a<rate_intervention>
on the transmission rate parameter. If these are present inx
, they are returned as is, or substituted if missing. Any other interventions are also returned. Ifx
isNULL
, dummy contact and rate interventions are returned in a list..cross_check_vaccination()
returnsx
after checking that it is suitable forpopulation
, or a dummy vaccination regime withdoses
number of doses for each age group..cross_check_timedep()
returnsx
ifx
is notNULL
, otherwise returns a dummy function operating on the transmission rate parameter by default; see.no_time_dependence()
;.cross_check_popchange()
returnsx
after checks againstpopulation
ifx
is notNULL
, otherwise returns a dummy list with no population change; see.no_population_change()
.