Learn R Programming

bayesPop (version 4.2-2)

bayesPop-package: Probabilistic Population Projection

Description

The package allows to generate population projections for all countries of the world using several probabilistic components, such as total fertility rate (TFR) and life expectancy.

Arguments

Details

ll{ Package: bayesPop Type: Package Version: 4.2-2 Date: 2013-12-2 License: GPL (>=2) URL: http://bayespop.csss.washington.edu } The main function is called pop.predict. It uses trajectories of TFR from the bayesTFR package and life expectancy from the bayesLife package and for each trajectory it computes a population projection using the Cohort component method. It results in probabilistic age and sex specific projections. Various plotting functions are available for results visualization (pop.trajectories.plot, pop.pyramid, pop.trajectories.pyramid), as well as a summary function (summary.bayesPop.prediction).

References

A. E. Raftery, N. Li, H. Sevcikova , P. Gerland, G. K. Heilig (2012). Bayesian probabilistic population projections for all countries. Proceedings of the National Academy of Sciences 109:13915-13921.

See Also

bayesTFR, bayesLife

Examples

Run this code
sim.dir <- tempfile()
# Generates population projection for one country
country <- 'Netherlands'
pred <- pop.predict(countries=country, output.dir=sim.dir)
summary(pred, country)
pop.trajectories.plot(pred, country)
pop.pyramid(pred, country)
pop.pyramid(pred, country, year=2100, age=1:26)
unlink(sim.dir, recursive=TRUE)

# Here are commands needed to run probabilistic projections
# from scratch, i.e. including TFR and life expectancy.
# Note that running the first four commands 
# (i.e. predicting TFR and life expectancy) can take 
# LONG time (up to several days; see below for possible speed-up). 
# For a toy simulation, set the number of iterations (iter) 
# to a small number.
sim.dir.tfr <- 'directory/for/TFR'
sim.dir.e0 <-  'directory/for/e0'
sim.dir.pop <- 'directory/for/pop'

# Estimate TFR parameters (speed-up by including parallel=TRUE)
run.tfr.mcmc(iter='auto', output.dir=sim.dir.tfr, seed=1)

# Predict TFR (if iter above < 4000, reduce burnin and nr.traj accordingly)
tfr.predict(sim.dir=sim.dir.tfr, nr.traj=2000, burnin=2000)

# Estimate e0 parameters (females) (speed-up by including parallel=TRUE)
# Can be run independently of the two commands above
run.e0.mcmc(sex='F', iter='auto', output.dir=sim.dir.e0, seed=1)

# Predict female and male e0	
# (if iter above < 22000, reduce burnin and nr.traj accordingly)
e0.predict(sim.dir=sim.dir.e0, nr.traj=2000, burnin=20000)

# Population prediction
pred <- pop.predict(output.dir=sim.dir.pop, verbose=TRUE, 
    inputs = list(tfr.sim.dir=sim.dir.tfr, e0F.sim.dir=sim.dir.e0, e0M.sim.dir='joint_'))
pop.trajectories.plot(pred, 'Madagascar', nr.traj=50, sum.over.ages=TRUE)
pop.trajectories.table(pred, 'Madagascar')

Run the code above in your browser using DataLab