Replication Files This repository contains all code needed to replicate the estimates in the paper "Alternative estimates of the centenarian population in Argentina for census years 2001, 2010, and 2022" by Matias Battocchio and Carlos Grushka. The analysis uses four independent methods to estimate the centenarian and super-centenarian population of Argentina for the census years 2001, 2010, and 2022. --- Repository structure ``` repo/ │ ├── inputs/ # Raw data — do not modify │ ├── tm_0810_totalpais.xlsx # INDEC life table 2008–10 │ ├── tm_0001_totalpais.xlsx # INDEC life table 2000–01 │ ├── censo_1991.xlsx # Census 1991 population by age and sex │ ├── censo_2001.xlsx # Census 2001 population by age and sex │ ├── censo_2010.xlsx # Census 2010 population by age and sex │ ├── censo_2022.xlsx # Census 2022 population by age and sex │ ├── defunciones_centenarios.csv # Deaths aged 100+, 2001–2022 (DEIS) │ ├── df_covid19.csv # Vaccination records aged >=100 (NOMIVAC) │ ├── un_general.xlsx # UN General model life table │ ├── un_latino.xlsx # UN Latin American model life table │ └── un_chilean.xlsx # UN Chilean model life table │ ├── outputs/ # Generated files — do not edit manually │ ├── life_tables/ # Produced by extrapolar_tablas_v2.R │ │ ├── tm_0810_varones_kannisto.csv # Full single-year life table (men, 2008–10) │ │ ├── tm_0810_mujeres_kannisto.csv │ │ ├── tm_0001_varones_kannisto.csv │ │ ├── tm_0001_mujeres_kannisto.csv │ │ ├── nLx_0810_varones_kannisto.csv # Abridged (5-year) nLx — r-variable input │ │ ├── nLx_0810_mujeres_kannisto.csv │ │ ├── nLx_0001_varones_kannisto.csv │ │ ├── nLx_0001_mujeres_kannisto.csv │ │ ├── tab_0810_varones_kannisto.csv # Full abridged life table │ │ ├── tab_0810_mujeres_kannisto.csv │ │ ├── tab_0001_varones_kannisto.csv │ │ ├── tab_0001_mujeres_kannisto.csv │ │ ├── tm_0810_varones_gompertz.csv # Gompertz extrapolation (robustness) │ │ ├── tm_0810_mujeres_gompertz.csv │ │ ├── tm_0001_varones_gompertz.csv │ │ ├── tm_0001_mujeres_gompertz.csv │ │ ├── nLx_0810_varones_gompertz.csv │ │ ├── nLx_0810_mujeres_gompertz.csv │ │ ├── nLx_0001_varones_gompertz.csv │ │ └── nLx_0001_mujeres_gompertz.csv │ │ │ ├── figures/ # Produced by figure_1.py │ │ └── figure_1.png # 2x2 observed vs. extrapolated mortality │ │ │ ├── r_variable/ # Produced by scripts 2–5 │ │ ├── age_specific_growth_rates.csv # Intercensal r by age group and period │ │ ├── r_variable_results_2010.csv # Main r-variable estimates, census 2010 │ │ ├── r_variable_results_2001.csv # Main r-variable estimates, census 2001 │ │ ├── sensitivity_results.csv # Sensitivity analysis results │ │ ├── sensitivity_plot_varones.png # r observed vs OLS fit — men │ │ ├── sensitivity_plot_mujeres.png # r observed vs OLS fit — women │ │ ├── defunciones_centenarios.csv # Consolidated deaths (built by script 4) │ │ └── cohort_reconstruction_results.csv │ │ │ └── covid19_db/ # Produced by vaccination_covid_db.R │ ├── vaccination_plot.png # Cumulative first-dose vaccinations │ ├── centenarians_2021.csv # Main estimate: calendar year 2021 │ ├── centenarians_feb2021.csv # Robustness: Feb 2021 – Jan 2022 │ └── centenarians_mar2021.csv # Robustness: Mar 2021 – Feb 2022 │ └── codes/ # Analysis scripts (run from repo root) ├── extrapolar_tablas_v2.R # Step 1: extrapolate life tables ├── figure_1.py # Figure 1: observed vs. extrapolated mortality ├── r_variable_estimation.py # Step 2: r-variable estimates ├── sensitivity_estimation.py # Step 3: sensitivity analysis ├── build_deaths_input.py # Step 4: build deaths database ├── cohort_reconstruction.py # Step 5: extinct cohort estimates └── vaccination_covid_db.R # Step 6: COVID vaccination estimates ``` --- Methods overview The paper uses four approaches to estimate the centenarian population: Method Script(s) Census years R-variable (age-specific growth rates) scripts 2–3 2001, 2010 Extinct cohort (Vincent 1951) scripts 4–5 2001, 2010 COVID-19 vaccination registry (NOMIVAC) script 6 ~2021 --- Execution order All scripts must be run from the repository root in the sequence below. Scripts 2–5 form a chain where each step depends on the previous one. Script 6 is independent and can be run at any point. Step 1 — Life table extrapolation (R) ```r source("codes/extrapolar_tablas_v2.R") ``` Reads the official INDEC life tables from `inputs/` and extrapolates mortality beyond the observed ages using two parametric laws: Kannisto (1992): logistic deceleration model, recommended for ages 80+. Used as the primary life table in all main estimates. Gompertz (1825): exponential model, used as a robustness check in the sensitivity analysis. The extrapolation is fitted on ages 70–95 (2008–10) or 70–90 (2000–01) and predicts single-year mortality rates from age 100 (or 95) onwards. The script writes twelve output files to `outputs/life_tables/`: full single-year tables, full abridged (5-year) tables, and abridged nLx series for each sex, period, and extrapolation law. The nLx files are the direct inputs for steps 2 and 3. Figure 1 — Observed vs. extrapolated mortality rates (Python) ```bash python codes/figure_1.py ``` Generates a 2×2 panel plot of central death rates (nmx) on a log scale, covering ages 70–120, for men and women across both reference periods (2008–10 and 2000–01). Each panel shows three series: INDEC: observed nmx from the official life table (square markers). Kannisto: extrapolated nmx from the Kannisto model (dotted line). Gompertz: extrapolated nmx from the Gompertz model (solid line). Panels in the same row share a common y-axis scale to facilitate visual comparison across periods within each sex. Requires the full single-year life tables produced in Step 1. Output is saved to `outputs/figures/figure_1.png`. Step 2 — R-variable estimates (Python) ```bash python codes/r_variable_estimation.py ``` Implements the r-variable method (age-specific intercensal growth rates) to project the census population aged 50–54 forward to ages 100, 105, 110, and 115. The core formula is: ``` N_y = N_x · (nLx_y / nLx_x) · exp(−Σ r_i · n_i) ``` where the sum runs over 5-year intervals between base age x and target age y. For ages 90 and above, the aggregated r(90+) rate is used for all intervals. Growth rate periods: Census 2010: r(2001, 2022) Census 2001: r(1991, 2010) Outputs: `age_specific_growth_rates.csv`, `r_variable_results_2001.csv`, `r_variable_results_2010.csv`. Step 3 — Sensitivity analysis (Python) ```bash python codes/sensitivity_estimation.py ``` Replicates the r-variable estimates under six alternative scenarios, varying both the life table source and the growth rate methodology: lineal_r: OLS linear fit of r on age group index (1–9), using the same intercensal period as the main estimation. Predicted values replace the observed age-specific rates. decennal: 10-year age groups and growth rates computed from aggregated decennal census populations. gompertz: Gompertz nLx at target ages (100+); original INDEC nLx at base age. Both life tables are identical for ages ≤ 95 since they are anchored to the same INDEC values. un_general: UN General model life table nLx at both base and target. un_latino: UN Latin American model life table. un_chilean: UN Chilean model life table. UN model life tables are provided as Excel files (`inputs/un_*.xlsx`), each with two sheets: `"2008-10"` and `"2000-01"`. The appropriate sheet is selected automatically for each census period. The sheet for each period was chosen by matching the e50 of the model table to the e50 of the corresponding INDEC life table. Outputs: `sensitivity_results.csv`, `sensitivity_plot_varones.png`, `sensitivity_plot_mujeres.png`. Step 4 — Build deaths database (Python) ```bash python codes/build_deaths_input.py ``` Consolidates raw death records from two sources into a single long-format table used by the extinct cohort script: `cohortes_extintas_v4.xlsx` (Hoja1): deaths 2001–2019, already aggregated at national level. Columns: `ano`, `edad`, `sexo`, `cant`. `defunciones_centenarias_2020-2022.xlsx` (Hoja1): deaths 2020–2022 by province of residence. These are aggregated across provinces before appending. Records with unknown sex (code 9) and one spurious record (code 3) are discarded. Sex codes 1 and 2 are mapped to `men` and `women` respectively. Output: `outputs/r_variable/defunciones_centenarios.csv` (472 rows, years 2001–2022, ages 100–121). Step 5 — Extinct cohort estimates (Python) ```bash python codes/cohort_reconstruction.py ``` Implements the extinct cohort method of Vincent (1951) in its cross-sectional (period) form. For census year T and base age x₀, the period life table column lx is: ``` lx(x, T) = 0.5 · D(x, T + k) + D(x+1, T + k) + D(x+2, T + k) + ... where k = x − x₀ ``` The cross-section shifts one calendar year forward per age step, and the 0.5 weight on the first term reflects the Lexis half-year convention (at the census date, half of that year's deaths in age group x have already occurred). Centenarians (100+) and super-centenarians (110+) use different base ages (x₀ = 100 and x₀ = 110 respectively), so each estimate starts its own independent diagonal from the census year. Output: `outputs/r_variable/cohort_reconstruction_results.csv`. Step 6 — COVID-19 vaccination registry (R) ```r source("codes/vaccination_covid_db.R") ``` Estimates the centenarian population using unique vaccinated individuals in the NOMIVAC registry as a proxy for the living centenarian population. The main estimate uses the calendar year 2021 window, interpreted as the population as of 1 July 2021, under the assumptions that all centenarians were vaccinated, deaths were uniformly distributed across 2021, there was no international migration, and age was correctly recorded. Data preparation: The full NOMIVAC file (`datos_nomivac_covid19.csv`) is several GB and cannot be loaded into RAM directly. The filtered subset (`inputs/df_covid19.csv`, records with `grupo_etario == ">=100"`) is provided as a replication input. If the raw file needs to be re-filtered (e.g., to update with newer data), uncomment the `read_csv_chunked()` block in Section 1 of the script. Proration of unknown records: individuals with unknown province of residence (`"S.I."`) or unknown sex (`"S.I."`) are redistributed proportionally in two steps. First, unknown sex is prorated within each province group (identified provinces and unknown-province treated separately) using the observed F/M ratio of each group. Then the sex-adjusted counts from the unknown-province group are added to the national totals. This ensures all observed individuals are included in the final estimate regardless of whether province or sex was recorded. Outputs: `outputs/covid19_db/centenarians_2021.csv`, `centenarians_feb2021.csv`, `centenarians_mar2021.csv`, `vaccination_plot.png`. --- Dependencies R (scripts 1 and 6) Package Version tested Role MortalityLaws ≥ 2.0 Fitting Kannisto and Gompertz models tidyverse ≥ 2.0 Data manipulation, ggplot2, readxl, tidyr data.table ≥ 1.14 Chunked CSV reading (script 6 only) lubridate ≥ 1.9 Date parsing (script 6 only) hrbrthemes any Plot themes (script 6 only) viridis any Colour scales (script 6 only) ```r install.packages(c("MortalityLaws", "tidyverse", "data.table", "lubridate", "hrbrthemes", "viridis")) ``` Python (scripts 2–5 and Figure 1) Package Version tested Role pandas ≥ 1.5 Data loading and manipulation numpy ≥ 1.23 Numerical computations scipy ≥ 1.9 OLS regression (script 3 only) matplotlib ≥ 3.6 Plots (Figure 1 and script 3) openpyxl ≥ 3.0 Reading Excel inputs ```bash pip install pandas numpy scipy matplotlib openpyxl ``` --- Data sources Dataset Source Access INDEC life tables 2000–01 and 2008–10 Instituto Nacional de Estadística y Censos (INDEC) indec.gob.ar Census population counts 1991, 2001, 2010, 2022 INDEC — Censos Nacionales de Población, Hogares y Viviendas indec.gob.ar Death records aged 100+ (2001–2022) Dirección de Estadísticas e Información de Salud (DEIS), Ministerio de Salud Provided by DEIS upon request COVID-19 vaccination registry (NOMIVAC) Ministerio de Salud de Argentina datos.salud.gob.ar — open access UN model life tables United Nations Population Division population.un.org