Python 2.x
Python libraries:
Model input parameters: HC_parameters.py
Main model file: HC_main.py
import HC_main as hc
H = hc.HealthChecksModel(population_size=250000,
simulation_time=60, # number of years to simulate
HealthChecks=False,
randseed=1, # random number seed
randpars=False, # draw random parameter values?
nprocs=4 # number of CPU cores for parallelisation
)
H.Run()
The python object H
contains all simulated outcomes.
Examples of extracting aggregate results from the simulated population are given in getresults.py
.
The memory of a typical desktop computer permits a maximum of about 250000 people per model run.
Shell scripts are therefore used to simulate larger populations in batches.
nruns
in the shell scripts specifies the number of batches.ps
in the Python scripts gives the number of people in each batch.nruns*ps
.run
in the Python scripts is the batch number of the current run. This is passed through from the shell script as a command line argument to the Python script, and is used as the random seed to simulate the current batch. randpars
(True
or False
), a named argument to HealthChecksModel()
, specifies whether random parameter values are drawn from their uncertainty distributions for each batch. Used to quantify statistical uncertainty. Defaults to False
. The Python library getresults.py specifies which aggregate results are extracted from the simulated population.
The Python scripts output aggregate results from the simulated population in text files. These files are stored in the results folder.
The R code in the file tables.r formats the information in these output files to produce the tables in the paper.