R/summarise_tb_burden.R
summarise_tb_burden.Rd
Summarise TB burden metrics by region, globally, and for custom groupings. For variables with uncertainty represented by confidence intervals bootstrapping can be used (assuming a normal distribution) to include this in any estimated summary measures. Currently two statistics are supported; the mean (with 95\
summarise_tb_burden( df = NULL, dict = NULL, metric = "e_inc_num", metric_label = NULL, conf = c("_lo", "_hi"), years = NULL, samples = 1000, countries = NULL, compare_to_region = FALSE, compare_to_world = TRUE, custom_compare = NULL, compare_all_regions = TRUE, stat = "rate", denom = "e_pop_num", rate_scale = 1e+05, truncate_at_zero = TRUE, annual_change = FALSE, download_data = TRUE, save = TRUE, verbose = FALSE, ... )
df | Dataframe of TB burden data, as sourced by |
---|---|
dict | A tibble of the data dictionary. See |
metric | Character string specifying the metric to plot |
metric_label | Character string specifying the metric label to use. |
conf | Character vector specifying the name variations to use to specify the upper
and lower confidence intervals. Defaults to |
years | Numeric vector of years. Defaults to |
samples | Numeric, the number of samples to use to generate confidence
intervals (only used when |
countries | A character string specifying the countries to target. |
compare_to_region | Logical, defaults to |
compare_to_world | Logical, defaults to |
custom_compare | Logical, defaults to |
compare_all_regions | Logical, defaults to |
stat | Character string, defaults to |
denom | Character string defaulting to |
rate_scale | Numeric defaults to 100,000. The scaling to use for rates. If |
truncate_at_zero | Logical, defaults to |
annual_change | Logical, defaults to |
download_data | Logical, defaults to |
save | Logical, should the data be saved for reuse during the current R session. Defaults to
|
verbose | Logical, defaults to |
... | Additional arguments to pass to |
A tibble containing summarised values (with 95% confidence intervals) for the metric of choice stratified by area and year.
## Get the most recent year of data tb_burden <- get_tb_burden() most_recent_year <- max(tb_burden$year) ## Get summary of the e_mdr_pct_rr_new cases summarise_tb_burden( metric = "e_mdr_pct_rr_new", years = most_recent_year, stat = "mean", samples = 100, compare_all_regions = TRUE, compare_to_world = TRUE, verbose = TRUE )#>#>#>#>#>#>#>#>#>#>#>#>#>#> # A tibble: 7 x 5 #> area year e_mdr_pct_rr_new e_mdr_pct_rr_new_… e_mdr_pct_rr_new_… #> <fct> <int> <dbl> <dbl> <dbl> #> 1 Africa 2018 79.8 51.9 108. #> 2 Americas 2018 71.4 41.0 102. #> 3 Eastern Mediterr… 2018 79.6 39.2 120. #> 4 Europe 2018 83.3 45.8 121. #> 5 Global 2018 78.6 41.1 116. #> 6 South-East Asia 2018 96.4 79.7 113. #> 7 Western Pacific 2018 72.8 24.6 121.if (FALSE) { ## Get median (with 95% IQR) of the case fatality rate for regions and the world ## Boostrapping uncertainty in country measures summarise_tb_burden( metric = "cfr", years = most_recent_year, samples = 100, stat = "median", compare_all_regions = TRUE, compare_to_world = TRUE, verbose = FALSE ) ## Get summary data for the UK, Europe and the world ## Bootstrapping CI's summarise_tb_burden( metric = "e_inc_num", samples = 100, stat = "median", countries = "United Kingdom", compare_to_world = TRUE, compare_to_region = TRUE, verbose = FALSE ) ## Get an overview of incidence rates regionally and globally compared to the UK summarise_tb_burden( metric = "e_inc_num", stat = "rate", countries = "United Kingdom", compare_to_world = TRUE, compare_to_region = TRUE, verbose = FALSE ) }