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.mcmc.list creates an object of type
Existing simulation results can be accessed using the get.tfr.mcmc function. An existing prediction can be accessed via get.tfr.prediction. Existing convergence diagnostics can be accessed using the get.tfr.convergence and get.tfr.convergence.all functions.
There are two important datasets used as an input into the MCMC simulations, provided by the United Nations Population Division:
# This command produces output data such as in the directory ex-data
m <- run.tfr.mcmc(nr.chains=3, iter=50, 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