To calculate the UHC Billion, there are a series of functions made available through the billionaiRe package:
-
transform_uhc_data()
to transform raw values into normalized values used within the calculations. -
calculate_uhc_billion()
to calculate average service coverage, financial hardship, and the UHC single measure for each country and year in the data frame.. -
calculate_uhc_contribution()
to calculate country-level Billion for specified beginning and end year.
Run in sequence, these can calculate the entire UHC 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 the sample fake UHC data provided in the
package, uhc_df
.
library(billionaiRe)
uhc_df %>%
transform_uhc_data(end_year = 2023) %>%
calculate_uhc_billion() %>%
calculate_uhc_contribution(end_year = 2023, pop_year = 2023) %>%
dplyr::filter(ind %in% c("uhc_sm", "asc", "fh"),
year == 2023)
#> # A tibble: 3 × 9
#> iso3 year ind value type transform_value source contr…¹ contr…²
#> <chr> <dbl> <chr> <dbl> <chr> <dbl> <chr> <dbl> <dbl>
#> 1 AFG 2023 fh 25.4 Projected 74.6 NA -3.00e6 -7.11
#> 2 AFG 2023 asc 45.3 projected 45.3 WHO DDI ca… 1.72e6 4.06
#> 3 AFG 2023 uhc_sm 33.8 projected 33.8 WHO DDI ca… 4.41e4 0.104
#> # … with abbreviated variable names ¹contribution, ²contribution_percent