Analysis code for "The contribution of forecast uncertainty to lifespan uncertainty" -------------------------------------------------------------------------------------------------- Authors: Ricarda Duerst, Jonas Schöley Software: R version 4.5.1 Input data source: https://mortality.org/ (open access, free of charge) To replicate the analysis, run the source files in ascending numeric order. -------------------------------------------------------------------------------------------------- Files in vardecomp.zip: ./src: R code to replicate the data transformation, analysis and visualisation - 00-global_objects.R: Define global constants and functions - 00-penalized_lee_carter_functions.R: Define configuration of penalized Lee-Carter model - 10-specify_forecasting_models.R: Specify parametrization of forecasting models - 11-fit_forecasting_models.R: Fit mortality forecast models - 12-forecast_cohort_lifetables.R: Forecast the cohort lifetables based on diagonal approach - 13-diagnose_fits.R: Diagnose problems in model fit - 14-diagnose_forecasts.R: Diagnose problems in model forecast - 20-decompose_lifespan_variance.R: Perform lifespan variance decomposition - 31_error_scores.R: Calculate the forecast error scores and create a data frame for plotting - 32-create_plots_for_manuscript.R: Create data visuals of the results ./cfg - config.yaml: Global constants for the analysis ./dat/hmd: Input data from the Human Mortality Database ./denmark: - cohort_LT_1x1.txt: Male cohort lifetables by single year and age - Deaths_1x1.txt: Male death counts by single year and age - Exposures_1x1.txt: Male population exposures by single year and age ./englandwales: - cohort_LT_1x1.txt - Deaths_1x1.txt - Exposures_1x1.txt ./france: - cohort_LT_1x1.txt - Deaths_1x1.txt - Exposures_1x1.txt ./iceland: - cohort_LT_1x1.txt - Deaths_1x1.txt - Exposures_1x1.txt ./netherlands: - cohort_LT_1x1.txt - Deaths_1x1.txt - Exposures_1x1.txt ./norway: - cohort_LT_1x1.txt - Deaths_1x1.txt - Exposures_1x1.txt ./sweden - cohort_LT_1x1.txt - Deaths_1x1.txt - Exposures_1x1.txt ./out: output data - 20-vardecomp.qs: dataframe containing results of variance decomposition