run.e0.mcmc.extra {bayesLife}R Documentation

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.e0.mcmc.extra(sim.dir = file.path(getwd(), "bayesLife.output"), 
    countries = NULL, my.e0.file = NULL, 
    iter = NULL, thin = 1, burnin = 0, 
    parallel = FALSE, nr.nodes = NULL,  my.locations.file = NULL,
    country.overwrites = NULL, verbose = FALSE, verbose.iter = 100, ...)

Arguments

sim.dir

Directory with an existing simulation.

countries

Vector of country codes. These include codes of areas and regions (see column country_code in UNlocations).

my.e0.file

File name containing user-specified time series of life expectancy for countries for which the simulation should run (see Details below).

iter

Number of iterations to be used for sampling from the posterior distribution of the hyperparameters. By default, the number of (possibly thinned) iterations used in the existing simulation is taken.

thin

Thinning interval for sampling from the posterior distribution of the hyperparameters.

burnin

Number of iterations discarded before sampling from the posterior distribution of the hyperparameters.

parallel

Logical determining if the simulation should run multiple chains in parallel.

nr.nodes

Relevant only if parallel is TRUE. It gives the number of nodes for running the simulation in parallel. By default it equals to the number of chains contained in the existing simulation.

my.locations.file

File name containing user-specified locations. See Details below.

country.overwrites

This argument allows to overwrite some of the prior parameters for specific countries, stored in the global option of the same name, see e0mcmc.options. It is a data frame where each row corresponds to one country. Rows corresponding to countries that are not processed in this function are ignored.

verbose

Logical switching log messages on and off.

verbose.iter

Integer determining how often (in number of iterations) log messages are outputted during the estimation.

...

Additional parameters to be passed to the function snowFT::performParallel, if parallel is TRUE.

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.e0.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 e0 dataset. Or, it can be given by a user-specific file, using the argument my.e0.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.e0.file passed to run.e0.mcmc) get their parameters recomputed. Note that all countries must be included in the UNlocations dataset, but unlike in run.e0.mcmc, their include_code is ignored. As in the case of run.e0.mcmc, the default dataset of locations UNlocations can be overwritten using a file of the same structure as UNlocations passed via the my.locations.file argument. This file should be especially used, if e0 is simulated for new locations that are not included in UNlocations.

Value

An object of class bayesLife.mcmc.set.

Note

If there is an existing projection for the directory sim.dir, use e0.predict.extra to obtain projections for the extra countries used in this function.

Author(s)

Hana Sevcikova

See Also

run.e0.mcmc, e0.predict.extra

Examples

## Not run: 
m <- run.e0.mcmc(nr.chains = 1, iter = 20, thin = 1, verbose = TRUE)
m <- run.e0.mcmc.extra(countries = c(908,924), burnin = 10, verbose = TRUE)
summary(m, country = 924)
pred <- e0.predict(burnin = 10, verbose = TRUE)
summary(pred, country = 908)
## End(Not run)

[Package bayesLife version 5.2-0 Index]