Description Usage Arguments Details Value Note Author(s) See Also Examples
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.
1 2 3 4 5 |
sim.dir |
Directory with an existing simulation. |
countries |
Vector of country codes. These include codes of areas and regions (see column |
my.tfr.file |
File name containing user-specified TFR time series 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 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. It is also used when computing proposal of gamma covariance matrices (see |
parallel |
Logical determining if the simulation should run multiple chains in parallel. |
nr.nodes |
Relevant only if |
my.locations.file |
File name containing user-specified locations. See Details below. |
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 |
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 tfr
dataset. 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 should be included in the UNlocations
dataset, but unlike in run.tfr.mcmc
, their include_code
is ignored. As in the case of run.tfr.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 TFR is simulated for new locations that are not included in UNlocations
.
An object of class bayesTFR.mcmc.set
.
If there is an existing projection for the directory sim.dir
, use tfr.predict.extra
to obtain projections for the extra countries used in this function.
Hana Sevcikova, Leontine Alkema
run.tfr.mcmc
, tfr.predict.extra
1 2 3 4 5 6 7 8 9 10 | ## Not run:
sim.dir <- tempfile()
m <- run.tfr.mcmc(nr.chains=1, iter=20, output.dir=sim.dir, verbose=TRUE)
m <- run.tfr.mcmc.extra(sim.dir=sim.dir, countries=c(908,924), burnin=10, verbose=TRUE)
summary(m, country=924)
pred <- tfr.predict(m, burnin=10, use.tfr3=FALSE, verbose=TRUE)
summary(pred, country=908)
unlink(sim.dir, recursive=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.