1.12. Adapting the Model to a new Country

DYNAMIS-POP is a portable model and new countries can be added in a few steps. The project has two essential folders: Analysis and Model. The analysis folder contains all data and the analysis scripts for generating the starting population and the parameter files. The model itself with its scenario files is in the Model Folder.

1.12.1. Step 1: Add a country to the folder structure

Add the new country to the Analysis/Data/ folder structure. Example: Analysis/Data/NEW_20XX/. Country data files are organized in 4 folders:

  • AnalysisData: this is where the four required micro-data files are to be placed. (-> Chapter 1.6. Data Requirements)
  • DemographicProjections: This is where the four required demographic macro projection files are to be placed. Macro projections can be changed within the user interface of the model (thus to get started, files from another country can be used as dummies, like from the provided imaginary country)
  • Shapes: The R analysis scripts produce visualizations including country maps. For parameter estimation this is optional and the code could be removed / commented out from the scripts.
  • Parameters: this folder is empty at the moment. It is where the analysis scripts will place the parameter files and the starting population file.
../_images/AddCountryFolders.png

Figure: Project Folder Structure

1.12.2. Step 2: Create a country-specific setup R file

The folder Analysis/AnalysisInput/ contains a numbered set of all R scripts required to generate the starting population and all parameter files of the model. All but the first script are generic and should work for all country contexts. The first script creates the country specific data objects. Create a new setup file for the new country. This is best achieved by copying and modifying existing script (e.g. 01_Setup_ABC_2000.Rmd). Changes mostly regard file names and locations and calendar time values as models might start at different start years.

1.12.3. Step 3: Run all analysis scripts

Run all R scripts starting with the new setup script. The scripts are documented and (some) produce graphical analysis and illustrations. All files produce modgen .dat parameter files which are placed in the country’s parameters folder.

1.12.4. Step 4: Create a country-specific Modgen code file

In the Model folder, make a copy of the final model version folder. Open the solution file modgen-DYNAMIS-POP.sln in the Visual Studio. The only model file that has to be adapted is the file _CountryContext.mpp. Modify the _CountryContext file to fit the new country. Changes regard the names of districts and a set of calendar year ranges.

1.12.5. Step 5: Run the new country version of the model

Place the new starting population file in the Scenario folder of the model. Compile the application. Create a new scenario in the Scenario folder by adding all mpp files from the Parameters folder to the scenario. Check and edit the parameter files and scenario settings. Run the application . Enjoy!