Skip to content

polizzan/CompareKin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Changing Kinship Structures in East and West Germany Before and After Reunification

Purpose of This Repository

The repository CompareKin was created to enable the replication of findings reported in:

Changing Kinship Structures in East and West Germany Before and After Reunification,

hereafter our manuscript.

Summary of This Repository

The R code in this repository takes:

for two selected countries to run two-sex time-variant matrix kinship models using the R package DemoKin.

The R code automatically determines the time period for which fertility and mortality information exists for both countries and runs the kinship models for both countries for this overlapping time period only. The R code then processes the output from the matrix kinship models and compares the two selected countries graphically. The following graphical outputs are generated:

  1. an age x period plot of the average number of all kin combined in country 1 vs. country 2
  2. a plot of the average number of different kin in country 1 vs. country 2 at each age of the focal individual in the last year
  3. a plot of the average number of different kin in country 1 vs. country 2 at four different ages of the focal individual in each year
  4. an age x period plot of the ratio of the average number of different kin in country 1 vs. country 2

All graphical outputs listed above are generated for both female and male focal individuals. Currently, the graphical results are restricted to focal individuals born after the first year of the overlapping time period.

Finally, the R code generates:

  1. a plot of the total fertility rate (TFR) and life expectancy at birth (e0) in country 1 vs. country 2 in each year
  2. a plot of the mean generational length in country 1 vs. country 2 in each year
  3. a file input.txt that stores the parameters used for the country comparison
  4. an R.Data file containing the outputs from the matrix kinship models

All outputs are stored in an automatically generated and time stamped folder out-country1-country2. Plots are saved as both .pdf and .svg files. In addition, there is an option to change the default inputs for the analysis, such as the comparison countries of interest.

Structure of This Repository

The repository CompareKin contains two folders:

1. scripts

This folder contains all analysis files necessary to replicate our findings:

  • The files 00_main.R, 01_out-kin.R, 02_des-a.R, and 02_des-b.R generate the main findings reported in our manuscript. The file 00_main.R (a) installs all R packages necessary to replicate our findings, (b) runs the matrix kinship models, and (c) automatically executes the files 01_out-kin.R, 02_des-a.R, and 02_des-b.R. The latter three files generate the plots reported in our manuscript and save these plots – in .pdf and .svg format – in the time stamped folder out-country1-country2.
  • The standalone file 99_DE-fert.R generates a plot comparing female and male age-specific fertility rates in East and West Germany based on data from the Human Fertility Collection (HFC). This plot is saved – in .pdf and .svg format – in an automatically generated folder out.

2. data

This folder stores all data files necessary to replicate our main findings, generated by the 00_main.R, 01_out-kin.R, 02_des-a.R, and 02_des-b.R files described above.

Our main findings are based on age-, sex-, and country-specific data from the Human Mortality Database (HMD), version 26 February 2024, and the Human Fertility Database (HFD), downloaded on 09 March 2024. The .zip files in the data folder do not need to be unzipped before running the analysis files in the scripts folder.

HMD and HFD data are distributed under a Creative Commons Attribution 4.0 International License. Please note the version or downloaded dates above. Data distributed by HMD and HFD may have been updated or revised in the meantime.

How to Use This Repository

In order to run the R code provided in the repository CompareKin, please proceed in the following order:

  1. Download the repository from github. If applicable, unzip the downloaded folder and place it in a location convenient for you.
  2. Double click on the file CompareKin.Rproj. This should open RStudio on your machine.
  3. Within RStudio, click on File/Open File... and select the analysis file 00_main.R located in the scripts folder.
  4. You should now be able to run our R code without adjusting any directories.

License

This work is licensed under a Creative Commons Attribution 4.0 International License.

CC BY 4.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages