mig.median.set | R Documentation |
These functions are to be used by expert analysts. They allow to change the projection medians either to specific values, or shift the medians by a given constant or align one projection object with another.
mig.median.set(sim.dir, country, values, years = NULL, ...)
mig.median.shift(
sim.dir,
country,
reset = FALSE,
shift = 0,
from = NULL,
to = NULL
)
mig.median.reset(sim.dir, countries = NULL)
mig.align.predictions(
sim.dir1,
sim.dir2,
country.codes = NULL,
years = NULL,
...
)
mig.shift.prediction.to.wpp(sim.dir, ...)
sim.dir |
Directory containing the prediction object. |
country |
Name or numerical code of a country. |
values |
Vector of the new median values. |
years |
Numeric vector giving years for which to change the median.
In |
... |
Additional arguments passed to the underlying adjustment functions, such as
|
reset |
Logical. If |
shift |
Constant by which the medians should be offset. It is not used if |
from |
Year from which the offset/reset should start. By default, it starts at the first prediction period. |
to |
Year until which the offset/reset should be done. By default, it is set to the last prediction period. |
countries |
Vector of country names or codes. If this argument is |
sim.dir1 |
Directory with the bayesMig prediction object to be adjusted. |
sim.dir2 |
Directory with the bayesMig prediction object used to align the medians from |
country.codes |
Numerical codes of countries to adjust. By default all countries
found in |
The function mig.median.set
can be used to set the medians of the
given country to specific values.
Function mig.median.shift
can be used to offset the medians by a specific constant, or to reset
the medians to their original values.
Function mig.median.reset
resets medians of the given countries
to the original values. By default it deletes adjustments for all countries.
Function mig.align.predictions
shifts medians stored in sim.dir1
to match
the medians in sim.dir1
.
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.
Function mig.shift.prediction.to.wpp
shifts the projected medians or means
(if stat
is “mean”), so that they correspond to the values found in the migproj1dt
or migproj5dt
datasets of the wpp package that either corresponds to the package used for the simulation itself
or is given by the wpp.year
argument. Currently, the function only works for wpp2024.
Note that regardless if it is an adjustment of the median or mean, the corresponding offset is always
converted to a shift of the median.
All functions return an updated object of class bayesMig.prediction
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.