The model needs to adhere to the structure specified by the modelbuilder package. Models built using the modelbuilder package automatically have the right structure. A user can also build a model list structure themselves following the modelbuilder specifications. If the user provides a file name, this file needs to be an RDS file and contain a valid modelbuilder model structure.

generate_stratified_model(mbmodel, stratum_list, par_stratify_list)

Arguments

mbmodel

modelbuilder model structure, either as list object or file name

stratum_list

A list of lists defining the stratification structure to be applied to the model. At a minimum, the list must contain one sublist with the following structure: stratumname a character string giving the name of the stratum (e.g., "age"); names a vector of character strings defining the names for each group within the stratum (e.g., c("child", "adult")); labels a vector of character strings defining the labels that correspond to each group within the stratum, which are applied to the model codes (e.g., c("c", "a")); comment a character string of any comments or notes for the stratum. The labels are appended to model state variables (e.g., S becomes S_c) and parameters (e.g., b becomes b_c).

par_stratify_list

A list that defines the stratification of parameters in reference to state variables. This list can be auto generated by calling the modelbuilder generate_stratifier_list.

Value

The function returns a modelbuilder model object (a list).

Details

This function takes as input a modelbuilder model and expands it according to specified stratifications (e.g. age groups).

Author

Andrew Tredennick and Andreas Handel

Examples

if (FALSE) { mbmodel <- readRDS("auxiliary/modelfiles/Coronavirus_vaccine_model_v2.Rds") strata_list <- list( stratumname = "risk", names = c("high risk", "low risk"), labels = c("h", "l"), comment = "This defines the risk structure." ) }