A repository with example code for master's thesis students performing country-level complexity-relatedness analyses.
Please refer to the document thesis_instructions.pdf on Toledo for general instructions.
- Download the raw data from the data sources specified below
- Specify the path to your raw data in
RAW_DATA_PATHin thedata_processing.Rscript - Specify the
baci_version,HS_versionandHS_digits, as well as the years for which you have BACI data in thedata_processing.Rscript - Run the
data_processing.Rscript, which will:- Import the BACI trade data
- Aggregate the trade flows to the specified number of digits (
HS_digits); recommended number of digits is 4 - Add the country ISO3 and product HS codes and descriptions
- Filter the dataset on the selected country and product sample (removing small nodes)
- Compute RCA_cp, M_cp, diversity_c, ubiquity_p, ECI_c, PCI_p, proximity_pp, and relatedness_cp (dens_cp)
- Export the country-product-year level dataset to
cp_df.csv
- Create new script(s) for your analysis
Note that the data_processing.R script serves as supporting material for the preprocessing of the data, and does not include all code required for the full analysis.
- CEPII BACI international trade data (HS07, 2007-2023)(https://www.cepii.fr/CEPII/en/bdd_modele/bdd_modele_item.asp?id=37)
- UN HS product descriptions (https://unstats.un.org/unsd/classifications/Econ)
- Download "All HS codes and descriptions" xlsx file for product descriptions for all HS digits
├── analysis
│ └── README.txt
├── complexity-thesis-support.Rproj
├── data
│ ├── data_processed
│ └── data_raw
├── processing
│ └── data_processing.R
└── README.md
Please cite this repository as
De Wettinck, Q. (2025). Complexity Thesis Support [Source code]. https://github.com/quintendewettinck/complexity-thesis-support
BibTeX:
@software{De_Wettinck_Complexity_Thesis_Support_2025,
author = {De Wettinck, Quinten},
license = {MIT},
month = oct,
title = {{Complexity Thesis Support}},
url = {https://github.com/quintendewettinck/complexity-thesis-support},
year = {2025}
}For more details on the calculation and interpretation of the metrics, see
De Wettinck, Q., De Bruyne, K., & Bam, W. (2025). Economic Complexity: Promise and Potential for Sustainable Development Decision Support (SSRN Scholarly Paper No. 5412234). Social Science Research Network. https://doi.org/10.2139/ssrn.5412234
BibTeX:
@misc{DeWettinck.etal2025,
type = {{{SSRN Scholarly Paper}}},
title = {Economic {{Complexity}}: {{Promise}} and {{Potential}} for {{Sustainable Development Decision Support}}},
shorttitle = {Economic {{Complexity}}},
author = {De Wettinck, Quinten and De Bruyne, Karolien and Bam, Wouter},
year = 2025,
number = {5412234},
publisher = {Social Science Research Network},
address = {Rochester, NY},
doi = {10.2139/ssrn.5412234},
urldate = {2025-10-22},
archiveprefix = {Social Science Research Network},
langid = {english}
}