Learn R Programming

bayesPop (version 0.2-2)

pop.pyramid: Probabilistic Population Pyramid

Description

Functions for plotting probabilistic population pyramid for any country and projection period.

Usage

pop.pyramid(pop.pred, country, year = NULL, pi = c(80, 95), 
    proportion = FALSE, main = NULL, age = 1:21)
    
pop.pyramid.all(pop.pred, year = NULL,
    output.dir = file.path(getwd(), 'pop.pyramid'),
	output.type = "png", verbose = FALSE, ...)
	
pop.trajectories.pyramid(pop.pred, country, year = NULL, pi = c(80, 95), 
    nr.traj = NULL, proportion = FALSE, main = NULL, age = 1:21)
    
pop.trajectories.pyramid.all(pop.pred, year = NULL,
    output.dir = file.path(getwd(), 'pop.traj.pyramid'),
	output.type = "png", verbose = FALSE, ...)

Arguments

pop.pred
Object of class bayesPop.prediction.
country
Name or numerical code of a country.
year
Year within the projection period to be plotted. Default is the start year of the prediction. In the functions pop.pyramid.all and pop.trajectories.pyramid.all, the year argument can be a vector of years.
pi
Probability interval. It can be a single number or an array.
proportion
Logical. If TRUE the pyramid contains the distribution of rates of age-specific counts and population totals.
main
Titel of the plot. By default it is the country name and projection year.
age
Integer vector of age indices. Value 1 corresponds to age 0-4, value 2 corresponds to age 5-9 etc. Last available age goup is 130+ which corresponds to index 27. The purpose of this argument here is mainly to controls the top of the pyramid.
output.dir
Directory into which resulting graphs are stored.
output.type
Type of the resulting files. It can be png, pdf, jpeg, bmp, tiff, or postscript.
verbose
Logical switching log messages on and off.
nr.traj
Number of trajectories to be plotted. If NULL, all trajectories are plotted, otherwise they are thinned evenly.
...
Arguments passed to the underlying functions.

Details

For a given country and projection year the pop.pyramid function generates a population pyramid that includes given confidence intervals. pop.pyramid.all creates such pyramids for all countries for which a projection is available and for all years given by the year argument.

Functions pop.trajectories.pyramid and pop.trajectories.pyramid.all work in a similar way. The only difference is that the pyramid is created using the population trajectories.

See Also

pop.trajectories.plot, bayesPop.prediction, summary.bayesPop.prediction

Examples

Run this code
sim.dir <- file.path(.find.package("bayesPop"), "ex-data", "Pop")
pred <- get.pop.prediction(sim.dir)
pop.pyramid(pred, "Netherlands", 2045)
pop.trajectories.pyramid(pred, "Netherlands", 2045, age=1:25)

Run the code above in your browser using DataLab