| get.thinned.tfr.mcmc | R Documentation |
The function get.thinned.tfr.mcmc accesses
a thinned and burned version of the given Phase II MCMC set. create.thinned.tfr.mcmc creates or updates such a set.
get.thinned.tfr.mcmc(mcmc.set, thin = 1, burnin = 0)
create.thinned.tfr.mcmc(mcmc.set, thin = 1, burnin = 0,
output.dir = NULL, verbose = TRUE, uncertainty = FALSE,
update.with.countries = NULL)
mcmc.set |
Object of class |
thin, burnin |
Thinning interval and burnin used for creating or identifying the thinned object. |
output.dir |
Output directory. It is only used if the output goes to a non-standard directory. |
verbose |
Logical switching log messages on and off. |
uncertainty |
If users want to save the thinned estimated TFR in the new mcmc object, this parameter should be set |
update.with.countries |
If an existing set is to be updated, this should be a vector of country indices for the update. |
The function create.thinned.tfr.mcmc is called from tfr.predict and thus, the resulting object contains exactly the same MCMCs used for generating projections. In addition, it can be also called from tfr.diagnose if desired, so that the projection process can re-use such a set that leads to a convergence.
The thinning is done as follows: The given burnin is removed from the beginning of each chain in the original MCMC set. Then each chain is thinned by thin using equal spacing and all chains are collapsed into one single chain per parameter. They are stored in the main simulation directory under the name ‘thinned_mcmc_t_b’ where t is the value of thin and b the value of burnin.
If uncertainty=TRUE, the estimated TFR is thinned and saved as well.
Both functions return an object of class bayesTFR.mcmc.set. get.thinned.tfr.mcmc returns NULL if such object does not exist.
Hana Sevcikova
bayesTFR.mcmc.set, tfr.predict, tfr.diagnose
## Not run:
sim.dir <- tempfile()
m <- run.tfr.mcmc(nr.chains=2, iter=30, seed=1, output.dir=sim.dir, verbose=TRUE)
tfr.predict(m, burnin=15, use.tfr3=FALSE) # creates thinned MCMCs
mb <- get.thinned.tfr.mcmc(m, thin=1, burnin=15)
summary(mb, meta.only=TRUE) # length 30 = 2chains x (30-15)iters.
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.