Generates a world map of the net migration rate for given quantile and
time period, which can be either projection or estimation time period, using different techniques:
mig.map and mig.map.all use rworldmap, mig.ggmap uses ggplot2, and
mig.map.gvis creates an interactive map via GoogleVis. A map of
country-specific model parameters is also supported.
mig.map(pred, ...)mig.ggmap(pred, ...)
mig.map.gvis(pred, ...)
mig.map.all(
pred,
output.dir,
output.type = "png",
mig.range = NULL,
nr.cats = 50,
same.scale = TRUE,
quantile = 0.5,
file.prefix = "migwrldmap_",
...
)
get.mig.map.parameters(
pred,
mig.range = NULL,
nr.cats = 50,
same.scale = TRUE,
quantile = 0.5,
palette = "Blue-Red",
...
)
get.mig.map.parameters returns a list with elements:
The bayesMig.prediction object used in the function.
Value of the argument quantile.
If the argument same.scale is TRUE, this element
contains breakpoints for categorization generated using the quantiles.
Otherwise, it is NULL.
Number of categories.
The color palette.
Object of class bayesMig.prediction. Note that location codes
must correspond to the UN country codes in order to generate a world map.
In mig.map, ... are all arguments that can be passed
to tfr.map, such as quantile, year,
projection.index, par.name, adjusted, device, main,
device.args, and data.args.
In mig.map.gvis, ... are all arguments that can be passed
to tfr.map.gvis. In e0.ggmap, ... are arguments that can be passed
to tfr.ggmap. In addition, functions that use the rworldmap package accept
arguments passed to the mapCountryData function of the rworldmap package.
Directory into which resulting maps are stored.
Type of the resulting files. It can be “png”, “pdf”, “jpeg”, “bmp”, “tiff”, or “postscript”.
Range of the migration rate to be displayed. It is of the form
c(mig.min, mig.max). By default, the whole available range is considered.
Note that countries with values outside of the given range will appear white.
Number of color categories.
Logical controlling if maps for all years of this prediction object should be on the same color scale.
Quantile for which the map should be generated. It must be equal to one of the
values in dimnames(pred$quantiles)[[2]],
i.e. 0, 0.025, 0.05, 0.1, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9, 0.95, 0.975, 1.
Value 0.5 corresponds to the median.
Prefix for file names.
Color palette to use.
The functions only work for national simulations where location codes correspond to the countries' UN codes.
mig.map creates a single map for the given time period and quantile.
mig.map.all generates a sequence of maps, namely one for each projection period.
If the package fields is installed, a color bar legend at the botom of the map is created.
Function get.mig.map.parameters can be used in combination with mig.map.
(Note that get.mig.map.parameters is called from inside of mig.map.all.)
It sets breakpoints for the color scheme.
Function mig.ggmap is similar to mig.map, but used the ggplot2 package
in combination with the geom_sf function.
Function mig.map.gvis creates an interactive map using the googleVis package
and opens it in an internet browser. It also generates a table of the mapped values that
can be sorted by columns interactively in the browser.
By default, mig.map, mig.ggmap and mig.map.gvis produce maps of net migration rates.
Alternatively, the functions can be used to plot country-specific MCMC parameters into a world map.
They are given by the argument par.name. One can pass any value from
mig.parameter.names.cs().
tfr.map