Learn R Programming

bayesTFR (version 2.1-0)

run.tfr.mcmc.extra: Run MCMC for Extra Countries, Areas or Regions

Description

Run MCMC for extra countries, areas or regions. It uses the posterior distribution of model hyperparameters from an existing simulation to generate country-specific parameters.

Usage

run.tfr.mcmc.extra(sim.dir = file.path(getwd(), "bayesTFR.output"), 
    countries = NULL, my.tfr.file = NULL, 
    iter = NULL, thin = 1, burnin = 2000,
    parallel = FALSE, nr.nodes = NULL,  verbose = FALSE, verbose.iter = 100, ...)

Arguments

Value

An object of class bayesTFR.mcmc.set.

Rdversion

1.1

Details

The function can be used to make predictions for countries, areas or regions (further denoted as countries) that were not included in the MCMC estimation (invoked by run.tfr.mcmc). It creates MCMC traces for country-specific parameters. The purpose of this function is to have country-specific parameters available in order to be able to generate projections for additional countries or their aggregations, without having to re-run the often time-expensive MCMC simulation.

The set of countries to be considered by this function can be given either by their codes, using the argument countries, in which case the countries must be included in the UN WPP file (see UN2010). Or, it can be given by a user-specific TFR file, using the argument my.tfr.file. The function considers a union of both arguments. The function will ignore all countries that were used in the existing MCMC simulation for estimating the hyperparameters. Countries that already own country-specific parameters (e.g. because they were included in my.tfr.file passed to run.tfr.mcmc) get their parameters recomputed. Note that all countries must be included in the UN location file (see WPP2010_LOCATIONS), but unlike in run.tfr.mcmc, their include_code is ignored.

See Also

run.tfr.mcmc, tfr.predict.extra

Examples

Run this code
m <- run.tfr.mcmc(nr.chains=1, iter=20, verbose=TRUE)
m <- run.tfr.mcmc.extra(countries=c(908,924), burnin=10, verbose=TRUE)
summary(m, country=924)
pred <- tfr.predict(burnin=10, verbose=TRUE)
summary(pred, country=908)

Run the code above in your browser using DataLab