e0.map {bayesLife}R Documentation

World Map of the Life Expectancy


Generates a world map of the life expectancy for given quantile and projection or estimation period.


e0.map(pred, ...)
e0.map.all(pred, output.dir, output.type = "png", 
    e0.range = NULL, nr.cats = 50, same.scale = TRUE, 
    quantile = 0.5, file.prefix = "e0wrldmap_", ...)
get.e0.map.parameters(pred, e0.range = NULL, 
    nr.cats = 50, same.scale = TRUE, quantile = 0.5, ...)
e0.map.gvis(pred, ...)



Object of class bayesLife.prediction.


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 life expectancy to be displayed. It is of the form c(e0.min, e0.max). By default, the whole 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.


In e0.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 e0.map.gvis, ... are all arguments that can be passed to tfr.map.gvis. In addition, the first three functions accept arguments passed to the mapCountryData function of the rworldmap package.


e0.map creates a single map for the given time period and quantile. e0.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.e0.map.parameters can be used in combination with e0.map. (Note that get.e0.map.parameters is called from inside of e0.map.all.) It sets breakpoints for the color scheme using quantiles of a fitted gamma distribution.

Function e0.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, both e0.map and e0.map.gvis produce maps of life expectancy. 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 e0.parameter.names.cs.extended().


get.e0.map.parameters returns a list with elements:


The object of class bayesLife.prediction used in the function.


Value of the argument quantile.


If the argument same.scale is TRUE, this element contains breakpoints for categorization. It is generated from a fitted gamma distribution. Otherwise, it is NULL.


Number of categories.


Subset of the rainbow palette, starting from dark blue and ending at red.


Additional arguments passed to the function.


Hana Sevcikova, Adrian Raftery

See Also



## Not run: 
sim.dir <- file.path(find.package("bayesLife"), "ex-data", "bayesLife.output")
pred <- get.e0.prediction(sim.dir = sim.dir)
# Uses heat colors and seven categories by default
# Uses more colors with more suitable categorization
params <- get.e0.map.parameters(pred)
do.call('e0.map', params)
# Another projection year on the same scale
do.call('e0.map', c(list(year = 2043), params))

# Interactive map (requires Flash)
e0.map.gvis(pred, year = 2043)
## End(Not run)

[Package bayesLife version 5.0-1 Index]