Save intermediate computations so that they can be used as factors in rate expressions and returned as part of the simulation history. The definition of a factor is given here: https://canmod.net/misc/flex_specs#v0.1.0.

add_factr(model, factr_nm, formula)

Arguments

model

flexmodel object

factr_nm

name of the new intermediate factor

formula

formula (or string) that follows this spec, https://canmod.net/misc/flex_specs#v0.1.0, or 1-by-1 struc-class object describing the intermediate factor. See avail_for_factr for a function that will return the names of all variables that are available for use in these formulas and struc-class objects.

Value

updated flexmodel object

See also

See vec_factr to add more than one intermediate factor at the same time.

Other flexmodel_definition_functions: add_linearized_outflow(), add_parallel_accumulators(), add_rate(), add_state_mappings(), add_state_param_sum(), initial_population(), mat_rate(), rep_rate(), update_disease_free_state(), update_linearized_params(), update_tmb_indices(), vec_rate()