Learn R Programming

bayesTFR (version 1.2-0)

get.thinned.tfr.mcmc: Creating and Accessing Thinned MCMCs

Description

The function get.thinned.tfr.mcmc accesses a thinned and burned version of the given MCMC set. create.thinned.tfr.mcmc creates such set.

Usage

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)

Arguments

Value

Both functions return an object of class bayesTFR.mcmc.set. get.thinned.tfr.mcmc returns NULL if such object does not exist.

Rdversion

1.1

Details

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 lead 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.

See Also

bayesTFR.mcmc.set, tfr.predict, tfr.diagnose

Examples

Run this code
sim.dir <- file.path(.find.package("bayesTFR"), "ex-data", 'bayesTFR.output')
m <- get.tfr.mcmc(sim.dir)
# MCMC created when generating predictions using:
# tfr.predict(m, burnin=30)
mb <- get.thinned.tfr.mcmc(m, thin=1, burnin=30)
summary(mb, meta.only=TRUE) # length 60 = 3chains x (50-30)iters.

Run the code above in your browser using DataLab