Skip to contents

Creates a new directory for a simulation and generates a configuration XML file. The configuration is read by the DYNAMO-HIA model to run the configured simulation. Simulation results will be stored in the same directory. The function overwrites existing configuration files.

Usage

create_simulation_dir(
  simulation_name,
  population_name,
  starting_year,
  number_of_years,
  population_size,
  ref_scenario_name,
  has_newborns = FALSE,
  min_age = 0,
  max_age = 95,
  time_step = 1,
  random_seed = NULL,
  scenarios = list(),
  diseases = list(),
  risk_factors = list(),
  relative_risks = list()
)

Arguments

simulation_name

A character string with the name of the simulation directory to be created.

population_name

A character string with the name of the population directory to be used.

starting_year

A numeric indicating the year in which the simulation starts.

number_of_years

A numeric indicating the duration of the simulation in years.

population_size

A Numeric indicating the size of the population to simulate.

ref_scenario_name

A character string with the name of the reference scenario.

has_newborns

A logical for whether to include newborns in the simulation. Default is FALSE.

min_age

A numeric indicating the minimum age for the population (0-95). Default is 0.

max_age

A numeric indicating the maximum age for the population (0-95). Default is 95.

time_step

A numeric indicating the time step for the simulation. Must be 1.

random_seed

An optional seed for random number generation.

scenarios

A list of scenario configurations. Each scenario must be a list containing:

  • uniquename: A character string which uniquely identifies the scenario

  • successRate: A numeric which specifies the success rate between 0 and 100

  • targetMinAge: A numeric which sets the minimum target age (0-95)

  • targetMaxAge: A numeric which sets the maximum target age (0-95)

  • targetSex: A numeric which indicates the target sex code (0: male; 1: female; 2: both)

  • transfilename: A character string which specifies the transition filename

  • prevfilename: A character string which specifies the prevalence filename

diseases

A list of disease configurations. Each disease must be a list containing:

  • uniquename: A character string which uniquely identifies the disease

  • prevfilename: A character string which specifies the prevalence filename

  • incfilename: A character string which specifies the incidence filename

  • excessmortfilename: A character string which specifies the excess mortality filename

  • dalyweightsfilename: A character string which specifies the disability weights filename

risk_factors

A list containing a single risk factor configuration with:

  • uniquename: A character string which uniquely identifies the risk factor

  • transfilename: A character string which specifies the transition filename

  • prevfilename: A character string which specifies the prevalence filename

relative_risks

A list of relative risk configurations. Each relative risk must be a list containing:

  • RRindex: A character string which identifies the relative risk relationship

  • isRRfrom: A character string which specifies the source. Must be the name of a disease or risk factor

  • isRRto: A character string which specifies the target identifier. Must be the name of a disease or risk factor

  • isRRFile: A character string which specifies the relative risk file path

Value

Logical TRUE if directory creation and configuration was successful.

Details

The function creates a directory with the specified simulation name and generates a configuration.xml file inside it using the provided parameters.