These functions are to be used by expert analysts. They allow to change the projection medians either to specific values, including the WPP values, or shift the medians by a given constant or a factor.
e0.median.set(sim.dir, country, values, years = NULL, joint.male = FALSE)e0.median.shift(sim.dir, country, reset = FALSE, shift = 0,
from = NULL, to = NULL, joint.male = FALSE)
e0.median.adjust.jmale(sim.dir, countries, factors = c(1.2, 1.1))
e0.median.reset(sim.dir, countries = NULL, joint.male = FALSE)
e0.shift.prediction.to.wpp(sim.dir, joint.male = FALSE, ...)
All functions return an updated object of class bayesLife.prediction
.
Directory containing the prediction object.
Name or numerical code of a country.
Vector of country names or codes. In the e0.median.reset
function, if this argument is NULL
(default), the reset is done for all countries.
Array of the new median values.
Numeric vector giving years which values
correspond to. Ideally it should be of the same length as values
. If it is NULL
,
values
are set starting from the first prediction period. If values
correspond to consecutive years, only the first year might be given here. A year \(t\) represents a prediction period \([t_i, t_{i+1}]\) if \(t_i < t \leq t_{i+1}\).
Logical. If TRUE
, the function is applied to a male prediction that was generated using the joint female-male model implemented in the function e0.jmale.predict
.
Logical. If TRUE
medians in a range of from
and to
are reset to their original values.
Constant by which the medians should be offset. It is not used if reset
is TRUE
.
Year from which the offset/reset should start. By default, it starts at the first prediction period.
Year until which the offset/reset should be done. By default, it is set to the last prediction period.
It should be a vector where each element corresponds to one time period. The adjustment of male medians is done as e0m(t) = e0f(t) - gap(t)*factor(t)
.
Additional arguments passed to the underlying adjustment function. It can be verbose
to show/hide the progress of the adjustment and wpp.year
to adjust it to if it differs from the wpp year of the simulation.
Hana Sevcikova
The function e0.median.set
can be used to set the medians of the given country to specific values. Function e0.median.shift
can be used to offset the medians by a specific constant, or to reset the medians to their original BHM values. Function e0.median.adjust.jmale
adjusts male medians using factors that can expand or shrink the female-male gap.
Functione0.shift.prediction.to.wpp
shifts the projected medians so that they correspond to the values found in the e0Fproj
(joint.male = FALSE
) or e0Mproj
(joint.male = TRUE
) datasets of the wpp package that either corresponds to the package used for the simulation itself or is given by the wpp.year
argument. If using wpp2022, the dataset name is automatically adjusted depending if it is an annual or a 5-year simulation.
Function e0.median.reset
resets medians of the given countries to the original values. By default it deletes adjustments for all countries.
In all cases, if a median is modified, the corresponding offset is stored in the prediction object (element median.shift
). All functions write the updated prediction object back to disk. All functions in the package that use trajectories and trajectory statistics use the median.shift
values to offset the results correspondingly, i.e. trajectories are shifted the same way as the medians.