Skip to contents

scenario_best_in_region aims to reach the mean regional average annual change in which a country is at quantile_year. The target is based on the ARC between quantile_year and quantile_year - 5. If ARC is under the mean of the region, it will aim at the mean, and at the best value of the quantile if above the mean. small_is_best can be used to indicate is lower value is best or not.

Usage

scenario_best_in_region(
  df,
  value_col = "value",
  start_year = 2018,
  end_year = 2025,
  baseline_year = 2018,
  target_year = 2013,
  scenario_col = "scenario",
  scenario_name = "best_in_region",
  ind_ids = billion_ind_codes("all"),
  trim = TRUE,
  small_is_best = FALSE,
  keep_better_values = TRUE,
  upper_limit = 100,
  lower_limit = 0,
  trim_years = TRUE,
  start_year_trim = start_year,
  end_year_trim = end_year,
  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

Start year for scenario, defaults to 2018.

end_year

End year for scenario, defaults to 2025

baseline_year

Year from which the scenario is measured. Defaults to start_year

target_year

Year by which the scenario should eventually be achieved. Defaults to end_year

scenario_col

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

scenario_name

Name of the scenario. Defaults to scenario_percent_change_baseline_year

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

trim

logical to indicate if the data should be trimmed between upper_limit and lower_limit.

small_is_best

Logical to identify if a lower value is better than a higher one (e.g. lower obesity in a positive public health outcome, so obesity rate should have small_is_best = TRUE).

keep_better_values

logical to indicate if "better" values should be kept from value_col if they are present. Follows the direction set in small_is_best. For instance, if small_is_best is TRUE, then value_col lower than col will be kept.

upper_limit

limit at which the indicator should be caped. Can take any of "guess", or any numeric. guess (default) will take 100 as the limit if percent_change is positive, and 0 if negative.

lower_limit

limit at which the indicator should be caped. Can take any of "guess", or 0 to 100. guess (default) will take 0 as the limit if percent_change is positive, and 100 if negative.

trim_years

logical to indicate if years before start_year_trim and after end_year_trim should be removed

start_year_trim

(integer) year to start trimming from.

end_year_trim

(integer) year to end trimming.

default_scenario

name of the default scenario to be used.

Details

Calculates the regional target, then wraps around scenario_linear_change_col to aim at the target.

See also

Comparing scenarios scenario_bau(), scenario_best_of(), scenario_quantile()