Skip to contents

calculate_uhc_contribution() calculates country-level UHC contributions, in total population and percents, based on indicator level data. Calculates it for each country-year combination in the provided data, and for specific scenarios if specified.

Usage

calculate_uhc_contribution(
  df,
  value_col = "value",
  start_year = 2018,
  end_year = 2019:2025,
  pop_year = 2025,
  transform_value_col = "transform_value",
  contribution_col = stringr::str_replace(transform_value_col, "transform_value",
    "contribution"),
  contribution_pct_col = paste0(contribution_col, "_percent"),
  scenario_col = NULL,
  scenario_reported_estimated = "routine",
  scenario_covid_shock = "covid_shock",
  scenario_reference_infilling = "reference_infilling",
  ind_ids = billion_ind_codes("uhc", include_calculated = TRUE, include_subindicators =
    TRUE),
  default_scenario = "default"
)

Arguments

df

Data frame in long format, where 1 row corresponds to a specific country, year, and indicator.

value_col

Column name of column with indicator values.

start_year

Base year for contribution calculation, defaults to 2018.

end_year

End year(s) for contribution calculation, defaults to 2019 to 2025.

pop_year

Year used to pull in HPOP populations, defaults to 2025.

transform_value_col

Column name of column(s) with transformed indicator values, used to calculate contributions.

contribution_col

Column name of column(s) to store contribution (population) values. Must be the same length as transform_value_col.

contribution_pct_col

Column name of column(s) to store contribution (percent) values. Must be the same length as transform_value_col.

scenario_col

Column name of column with scenario identifiers. Useful for calculating contributions on data in long format rather than wide format.

scenario_reported_estimated

name of the reported/estimated scenario.

scenario_covid_shock

name of the scenario with the COVID-19 shock years.

scenario_reference_infilling

name of the WHO technical programs projections/imputations scenario.

ind_ids

Named vector of indicator codes for input indicators to the Billion. Although separate indicator codes can be used than the standard, they must be supplied as a named vector where the names correspond to the output of billion_ind_codes().

default_scenario

name of the default scenario.

Value

Data frame in long format.

Details

For more details on the UHC Billion calculation process and how this function ties in with the rest, see the vignette:

vignette("uhc", package = "billionaiRe")