The projection follows a method developed by Alkema et al. It uses historical data provided by the United Nations (included in the package) to simulate a posterior distribution of total fertility rates for all countries in the world simultaneously.
The main functions of the package are:
The order of the functions above roughly corresponds to a typical workflow when using the package: 1. run an MCMC simulation, 2. generate predictions, 3. analyze results (using the functions below). If there are countries that were not included in steps 1. and 2., or if there are aggregated regions for which a prediction is desired, one proceeds with the two functions at the bottom of the list above, followed by the analyzing functions below.
A number of functions analyzing results are included in the package:
For MCMC diagnostics, function coda.list.mcmc creates an object of type
There are a few important datasets used as an input into the MCMC simulations, provided by the United Nations Population Division:
L. Alkema, A. E. Raftery, P. Gerland, S. J. Clark, F. Pelletier, Buettner, T., Heilig, G.K. (2011). Probabilistic Projections of the Total Fertility Rate for All Countries. Demography, Vol. 48, 815-839. (A Working Paper version at
# This command produces output data such as in the directory ex-data
m <- run.tfr.mcmc(nr.chains=1, iter=60, seed=1, verbose=TRUE)
pred <- tfr.predict(m, burnin=30, verbose=TRUE)
summary(pred, country='Ghana')Run the code above in your browser using DataLab