The repository ReproMx was created to enable the replication of findings reported in:
Polizzi, A., & Tilstra, A. M. (2024). The impact of early death on birth counts in the United States, 1950 to 2019. PNAS Nexus, 3(6). https://doi.org/10.1093/pnasnexus/pgae058,
hereafter our manuscript.
The repository ReproMx contains two main folders, Journal and SocArXiv.
The main folder Journal contains all data and R scripts necessary to replicate the information reported in the journal version of our manuscript. This includes the information reported in the Supplementary Information. The data and analysis files are respectively stored in the sub-folders data and scripts.
This sub-folder stores all data files necessary to replicate our findings.
We use data from the United Nations World Population Prospects (UNWPP), version 2022, provided by the United Nations Department of Economic and Social Affairs (UNDESA). The .zip files provided in the data sub-folder do not need to be unzipped before running the analysis files in the scripts sub-folder.
UNWPP 2022 data are distributed under a Creative Commons license CC BY 3.0 IGO. Please note that our reported findings are based on UNWPP version 2022 and that data distributed by UNDESA may have been updated or revised in the meantime.
This sub-folder contains the analysis files necessary to replicate all findings reported in our main manuscript and the Supplementary Information using the statistical software R:
-
The file
98-data.Rloads the UNWPP input data from the data sub-folder. -
The file
99-functions.R(a) builds a functionlife.table()that calculates life table functions, taking as input a vector of age-specific mortality rates; (b) builds a functionCCPM()that stochastically or deterministically projects a starting population forward, taking as input information on the male and female population age structures, male and female survivorship ratios, male and female net migration counts, female fertility rates, as well as sex ratios at birth. -
The file
01-analysis.Rinstalls allRpackages necessary to replicate our findings. It automatically executes the files98-data.Rand99-functions.Rdescribed above. Furthermore, the file01-analysis.R(a) carries out counterfactual population projections, and (b) calculates the three formal demographic indicators reviewed in our manuscript (probability of survival to age 50, reproductive-age life expectancy, reproduction-survival ratio) for the specified countries and time period. Plots of 'missing births' and the three formal demographic indicators are stored in .pdf and .svg format in an automatically generated sub-folder out. The file01-analysis.Ralso stores the formal demographic indicators and the output from the counterfactual population projections in a combined.RDatafile in the automatically generated out sub-folder for later access.
The main folder SocArXiv contains all materials associated with version 1 and version 2 of our manuscript preprint, as posted on SocArXiv. This main folder is just for reference, as the analytical strategy and code have changed following the peer review of our manuscript.
In order to run the R code provided in the repository ReproMx, please proceed in the following order:
- Download the repository from
github. If applicable, unzip the downloaded folder and place it in a location convenient for you. - Double click on the file
ReproMx.Rprojin the Journal folder. This should openRStudioon your machine. - Within
RStudio, click onFile/Open File...and select the analysis file01-analysis.Rlocated in the scripts sub-folder. - You should now be able to run our code without adjusting any directories.
This work is licensed under a Creative Commons Attribution 4.0 International License.
