Skip to contents

calculate_hep_billion() calculates country-level HEP Billion based on the component indicators. It calculates the change for Prevent and Prepare between a start year and end year, and estimated the change for Detect and Respond based on its level in the end year. If data is not available for the end year for Detect and Respond, the latest year of observed data is used. Details are available in the methods report for the exact method applied.

Usage

calculate_hep_billion(
  df,
  scenario_col = NULL,
  transform_value_col = "transform_value",
  level_col = stringr::str_replace(transform_value_col, "transform_value", "level"),
  contribution_col = stringr::str_replace(transform_value_col, "transform_value",
    "contribution"),
  contribution_pct_col = paste0(contribution_col, "_percent"),
  start_year = 2018,
  end_year = 2019:2025,
  pop_year = 2025,
  ind_ids = billion_ind_codes("hep", include_calculated = TRUE)
)

Arguments

df

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

scenario_col

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

transform_value_col

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

level_col

Column name of column(s) with indicator levels. Should be same length as transform_value_col.

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.

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.

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().

Value

Data frame in long format.

Details

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

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