This pack contains code and data to exactly reproduce figures 2-4 of Riffe & Aburto (2020) Lexis Fields. Demographic Research To reproduce Figures 2-4 from the manuscript do the following: 1) register for the HMD at 2) download and install the latest versions of R and Rstudio 3) double click on the file Reproduce_DR-4426.Rproj This will open up a project in R studio 4) from the Rstudio file browser, open the file R/master.R 5) in lines 9-10, change the text in quotes to your HMD username and password 6) run the file, preferably line by line. This will install packages if necessary, download HMD data, and produce data files in /Data and figures 2-4 in Figures/ * There is also a separate script R/fig1_subplots.R, which creates the subcomponents of Fig 1. * A more thorough repository of items related to this paper can be found at: * Do get in touch if you need a hand getting started! Tim Riffe: More details: * The HMD files used are the single-age period lifetables, file names mltper_1x1 and fltper_1x1 for all countries with data after 1950. These lifetables are based on death counts tabulated in single ages and single year of occurrence, and exposure estimates produced by the HMD using a variety of demographic techniques, depending on the original data structure. Each lifetable has been subject to a parametric smoothing starting after age 80-95, depending on population size. Each lifetable contains all standard columns starting from death rates, mx. The variables that we use in our study are columns from these lifetables. Specifically, we calculate conditional lifespan variance as: Var = \int_{a=x}^\omega (a - e(x))^2 * \frac{d(a)}{l(x)} da The discrete implementation is in the function momentN() of the DistributionTTD package, which is based on the dx and ax lifetable columns. The standard deviation is the square root of variance. The other variables used are lifetable ex and lx columns as-is from the HMD files. * Software versions used in this article: Our results are based on R version 3.6.2 and the following package versions: devtools 2.2.2 colorspace 1.4-1 reshape2 1.4.3 data.table 1.12.8 HMDHFDplus 1.9.13 here 0.1 pacman 0.5.1 DistributionTTD 1.0.1