technical-notes.Rmd
Technical notes about the PACE-HRH package
The term global configuration refers to system-wide variables set up when the PACE-HRH package is started. The most important of these is the location of the input data spreadsheet - the Excel spreadsheet that defines experiment scenarios, baseline population data, clinical task descriptions, health-worker cadres, etc.
The file globalconfig.json contains declarations for global
configuration variables. The package reads globalconfig.json
from the R working directory (getwd()
) when the package is
initialized using any of the Initialize___
functions.
The package sets the variable GPE$globalConfigLoaded to TRUE once globalconfig.json has been read.
> pacehrh:::GPE$globalConfigLoaded
[1] TRUE
If the package can’t find a globalconfig.json it will use the following default values.
{
"configDirectoryLocation" : "./config",
"inputExcelFile" : "model_inputs.xlsx",
"suiteRngSeed" : 12345,
"startYear" : 2020,
"endYear" : 2040
}
If you want to override these defaults by writing your own globalconfig.json file, we’ve provided a sample in the util directory of the GitHub repository.
set.seed()
with a random number
seed value. The system uses a seed value provided by the user in the
seed =
parameter of the RunExperiments()
function, or this global configuration value.SetGlobalStartEndYears()
function to
set start and end years.The PACE-HRH package uses three R environments.
pacehrh:::globalPackageEnvironment (alias pacehrh:::GPE) stores configuration information for the entire package.
pacehrh:::baseValuesEnvironment (alias pacehrh:::BVE) stores the base values for stochastic trials.
pacehrh:::experimentValuesEnvironment (alias pacehrh:::EXP) stores the actual values, after applying stochastic variation, used in each trial.
At the start of a suite of trials (RunExperiments()
),
baseline information is loaded into the BVE environment. For each trial
in the suite, stochastic variations are applied to values in the BVE,
and the new values are saved in the EXP environment. The trial is then
run based on the values in the EXP environment.
You can view the current contents of any of the environments with R’s
ls.str()
command.
For more information on the RStudio working directory, see RStudio support.