scenario_dip_recover()
creates a scenario where there is a rapid
return to the previous situation after a dip. The same annual rate of change (AROC) as
before dip is applied from the recovery_year
.
Usage
scenario_dip_recover(
df,
start_year = 2018,
dip_year = 2020,
recovery_year = 2021,
progressive_recovery = FALSE,
aroc_type = c("lastest_year", "average_years_in_range"),
aroc_start_year = start_year,
end_year = 2025,
value_col = "value",
scenario_col = "scenario",
scenario_name = "dip_recover",
ind_ids = billion_ind_codes("all"),
default_scenario = "default",
source = sprintf("WHO DDI, %s", format(Sys.Date(), "%B %Y")),
...
)
scenario_dip_recover_iso3(
df,
iso3,
start_year = 2018,
dip_year = 2020,
recovery_year = 2021,
progressive_recovery = FALSE,
aroc_type = c("lastest_year", "average_years_in_range"),
aroc_start_year = start_year,
end_year = 2025,
value_col = "value",
scenario_col = "scenario",
scenario_name = "dip_recover",
trim = TRUE,
small_is_best = FALSE,
keep_better_values = FALSE,
upper_limit = 100,
lower_limit = 0,
trim_years = TRUE,
start_year_trim = start_year,
end_year_trim = end_year,
ind_ids = billion_ind_codes("all"),
source = sprintf("WHO DDI, %s", format(Sys.Date(), "%B %Y")),
default_scenario = "default"
)
scenario_dip_recover_iso3_ind(
df,
iso3,
ind,
dip_year = 2020,
recovery_year = 2021,
progressive_recovery = FALSE,
aroc_type = c("lastest_year", "average_years_in_range"),
aroc_start_year = start_year,
baseline_year = 2018,
last_year = NULL,
start_year = 2018,
end_year = 2025,
value_col = "value",
scenario_col = "scenario",
scenario_name = "dip_recover",
ind_ids = billion_ind_codes("all"),
default_scenario = "default",
trim = TRUE,
small_is_best = FALSE,
keep_better_values = FALSE,
upper_limit = 100,
lower_limit = 0,
trim_years = TRUE,
start_year_trim = start_year,
end_year_trim = end_year,
source = sprintf("WHO DDI, %s", format(Sys.Date(), "%B %Y"))
)
Arguments
- df
Data frame in long format, where 1 row corresponds to a specific country, year, and indicator.
- start_year
Base year for contribution calculation, defaults to 2018.
- dip_year
(integer) year where the dip appends
- recovery_year
(integer) year from which the AROC will be applied
- progressive_recovery
(logical) TRUE if the recovery after dip should be progressive.
- aroc_type
(character) name of the type of AROC to be used. Can be either:
lastest_year
: only the latestreported
/estimated
year betweenstart_year
anddip_year
is used to calculateaverage_years_in_range
:
- aroc_start_year
(integer) year
- end_year
End year(s) for contribution calculation, defaults to 2019 to 2025.
- value_col
Column name of column with indicator values.
- 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 scenario
- 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()
.- default_scenario
name of the default scenario.
- source
Source to provide for calculated average service coverage and single measure.
- ...
additional parameters to be passed to
scenario_dip_recover_iso3()
- iso3
(character) ISO3 code of country to scenario
- trim
logical to indicate if the data should be trimmed between
upper_limit
andlower_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 insmall_is_best
. For instance, if small_is_best is TRUE, thenvalue_col
lower thancol
will be kept.- upper_limit
upper limit at which the indicator should be caped.
- lower_limit
lower_limit limit at which the indicator should be caped.
- trim_years
logical to indicate if years before
start_year_trim
and afterend_year_trim
should be removed- start_year_trim
(integer) year to start trimming from.
- end_year_trim
(integer) year to end trimming.
- ind
(character) name of the indicator on which to calculate the scenario
- baseline_year
(integer) identify baseline year on which the AROC should be calculated.
- last_year
(integer) identify last year where values were
reported
orestimated
betweenstart_year
andend_year
.- scenario
name of scenario column to be created
Details
scenario_dip_recover_iso3()
applies scenario_dip_recover()
to a specific iso3.
scenario_dip_recover_iso3_ind()
applies scenario_dip_recover()
to a specific ind
and iso3
combination.
Two types of AROC are supported:
lastest_year
: the AROC is calculated the values between thestart_year
and the lastreported
orestimated
value beforedip_year
is applied to the last reported value torecovery_year
onward.average_years_in_range
: all AROC between thearoc_start_year
and the lastreported
orestimated
value beforedip_year
are calculated. The average AROC for that period is then applied to the last reported value torecovery_year
onward.
If there are missing values between dip_year
and
recovery_year
, the last value from dip_year
is carried forward. This
applies only to countries where the indicator value for dip_year
is
reported
or estimated
. Otherwise, the value is carried with
scenario_bau
.
If progressive_recovery
is TRUE, then the recovery is
spread between the years between recovery_year
and end_year
. For
instance, if recovery_year
is 2021 and end_year
2025, then 2021 will have 0%
of AROC, 2022 25%, 2023 50%, 2024 75%, and 2025 100%.