# Goal: determine fraction of attributable health impact that can
# be attributed to differences in deprivation between the geographic
# units under analysis
## Create assessments for multiple geographic units for the age group
## 40 years and younger
results_age_groups <-
healthiar::attribute_health(
age_group = rep(c("below_40", "40_plus"), each = 9037),
exp_central = c(exdat_socialize$PM25_MEAN, exdat_socialize$PM25_MEAN-0.1),
cutoff_central = 0,
rr_central = 1.08,
erf_shape = "log_linear",
rr_increment = 10,
bhd_central = c(exdat_socialize$MORTALITY_below_40, exdat_socialize$MORTALITY_40_plus),
population = c(exdat_socialize$POPULATION_below_40, exdat_socialize$POPULATION_40_plus),
geo_id_micro = rep(exdat_socialize$CS01012020, 2))
## Difference in attributable impacts between geographic units
## that is attributable to differences in deprivation
results <- socialize(
age_group = c("below_40", "40_plus"),
ref_prop_pop = c(0.5, 0.5),
output_attribute = results_age_groups,
geo_id_micro = exdat_socialize$CS01012020,
social_indicator = exdat_socialize$score,
n_quantile = 10,
increasing_deprivation = TRUE)
results$social_main |>
dplyr::filter(difference_type == "relative") |>
dplyr::filter(difference_compared_with == "overall") |>
dplyr::select(first, last, difference_type, difference_value, comment)
Run the code above in your browser using DataLab