To calculate the HEP Billion, there are a series of functions made available through the billionaiRe package:
-
transform_hep_data()
to transform raw values into normalized values used within the calculations. For now, this is primarily calculating the total prevent numerators and denominators for campaign and routine data. -
calculate_hep_components()
to calculate component indicators (Prevent coverages), the HEP index, and levels for all components. -
calculate_hep_billion()
to calculate the change for the three HEP components (DNR, Prepare, and Prevent), their contribution to the Billion, and overall HEPI change and contribution.
Run in sequence, these can calculate the entire HEP Billion, or they
can be run separately to produce different outputs as required. Details
on the inputs of each function are available in their individual
documentation, but below you can see the quick and easy Billions
calculation done using the sample fake HEP data provided in the package,
hep_df
.
library(billionaiRe)
hep_df %>%
transform_hep_data() %>%
calculate_hep_components() %>%
calculate_hep_billion(end_year = 2023) %>%
dplyr::filter(ind %in% c("prevent",
"espar",
"detect_respond",
"hep_idx"),
year == 2023)
#> # A tibble: 4 × 12
#> iso3 year ind value type source trans…¹ use_d…² use_c…³ level contr…⁴
#> <chr> <dbl> <chr> <dbl> <chr> <chr> <dbl> <lgl> <lgl> <dbl> <dbl>
#> 1 AFG 2023 espar 51.2 Proj… NA 51.2 NA NA 3 5.00e6
#> 2 AFG 2023 detect_r… 91 Proj… NA 91 NA NA 5 2.23e6
#> 3 AFG 2023 prevent NA proj… Unite… 100 NA NA 5 0
#> 4 AFG 2023 hep_idx NA proj… WHO D… 80.7 NA NA 4 7.22e6
#> # … with 1 more variable: contribution_percent <dbl>, and abbreviated variable
#> # names ¹transform_value, ²use_dash, ³use_calc, ⁴contribution