| Title: | Shapley Value Decomposition of Health-Adjusted Life Expectancy |
|---|---|
| Description: | Implements a Shapley-value framework to decompose changes in health-adjusted life expectancy (HALE) into additive contributions of individual diseases or causes, fully accounting for higher-order interactions. Separates mortality and disability effects and provides second-order Shapley interaction indices. Uncertainty is propagated via parametric bootstrap. |
| Authors: | Jun-Yan Xi [aut, cre] (ORCID: <https://orcid.org/0000-0001-7473-7783>, affiliation: Sun Yat-sen University) |
| Maintainer: | Jun-Yan Xi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-09-28 12:37:06 UTC |
| Source: | https://github.com/cran/shapleyHALE |
Matches the age groups in demo_gbd.
age_info_demoage_info_demo
A data.table with columns:
numeric age group ID
start of interval
interval width (years)
Performs bootstrap uncertainty analysis by sampling rates from triangular distributions defined by point estimates and 95
bootstrap_shapley( deaths_data, ylds_data, base_year, target_year, cause_ids, age_ids, ages_info, n_boot = 1000, n_perm_inner = 5000, parallel = FALSE, n_cores = NULL )bootstrap_shapley( deaths_data, ylds_data, base_year, target_year, cause_ids, age_ids, ages_info, n_boot = 1000, n_perm_inner = 5000, parallel = FALSE, n_cores = NULL )
deaths_data |
data.table with mortality rates (cols: year, cause_id, age_id, val, lower, upper) |
ylds_data |
data.table with YLD rates (same structure) |
base_year |
baseline year |
target_year |
target year |
cause_ids |
character vector of cause IDs |
age_ids |
numeric vector of age IDs in correct order |
ages_info |
data.frame with age_start and width, matching age_ids |
n_boot |
number of bootstrap iterations (default 1000) |
n_perm_inner |
number of Shapley permutations per bootstrap (default 5000) |
parallel |
logical, use parallel processing? |
n_cores |
number of cores (NULL = detectCores()-1) |
list containing point estimates and bootstrap summaries
Sullivan method combining mortality and YLD rates.
compute_hale(mx, yld_rate, ages)compute_hale(mx, yld_rate, ages)
mx |
numeric vector of age-specific mortality rates (per person-year) |
yld_rate |
numeric vector of YLD rates (per person-year) |
ages |
data.frame with columns 'age_start' and 'width' |
list containing HALE0 and LE0
ages <- data.frame(age_start = c(0,1,5), width = c(1,4,5)) compute_hale(c(0.01,0.02,0.05), c(0.1,0.1,0.1), ages)ages <- data.frame(age_start = c(0,1,5), width = c(1,4,5)) compute_hale(c(0.01,0.02,0.05), c(0.1,0.1,0.1), ages)
Quantifies pairwise synergies/antagonisms among the leading causes.
compute_shapley_interactions( base_mx, base_yld, target_mx, target_yld, causes, ages, top_n = 20, n_perm = 1000, point_est = NULL )compute_shapley_interactions( base_mx, base_yld, target_mx, target_yld, causes, ages, top_n = 20, n_perm = 1000, point_est = NULL )
base_mx |
matrix, baseline mortality rates |
base_yld |
matrix, baseline YLD rates |
target_mx |
matrix, target mortality rates |
target_yld |
matrix, target YLD rates |
causes |
character vector of all cause IDs |
ages |
data.frame with age_start and width |
top_n |
number of leading causes to consider (default 20) |
n_perm |
number of permutations (default 1000) |
point_est |
optional named vector of total Shapley values (for ranking) |
data.table with columns cause_A, cause_B, interaction
Create cause-rate matrix from GBD-style data.table
create_rate_matrix(data, year_val, cause_ids, age_ids)create_rate_matrix(data, year_val, cause_ids, age_ids)
data |
data.table with columns year, cause_id, age_id, val |
year_val |
numeric year |
cause_ids |
character vector of cause IDs |
age_ids |
numeric vector of age IDs in correct order |
matrix (ages x causes)
A small simulated dataset mimicking GBD cause-specific mortality and YLD rates.
demo_gbddemo_gbd
A data.table with columns:
1 = mortality, 3 = YLD
3 = both sexes
1990 or 2023
character cause identifier
cause name
numeric age group ID
point estimate (rate)
upper 95% UI
lower 95% UI
Simulated for package examples.
Decomposes the HALE change between baseline and target into additive contributions of individual causes, separating mortality and disability effects.
run_shapley_decomp( base_mx, base_yld, target_mx, target_yld, causes = NULL, ages, n_perm = 5000 )run_shapley_decomp( base_mx, base_yld, target_mx, target_yld, causes = NULL, ages, n_perm = 5000 )
base_mx |
matrix of baseline mortality rates (age x cause) |
base_yld |
matrix of baseline YLD rates (age x cause) |
target_mx |
matrix of target mortality rates |
target_yld |
matrix of target YLD rates |
causes |
character vector of cause IDs (column names) |
ages |
data.frame with 'age_start' and 'width' |
n_perm |
number of random permutations (default 5000) |
list with total_change, total_effect, death_effect, disability_effect