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

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/get_outputs.R

Description

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

Usage

1
2
3
4
get.thinned.e0.mcmc(mcmc.set, thin = 1, burnin = 0)

create.thinned.e0.mcmc(mcmc.set, thin = 1, burnin = 0, 
    output.dir = NULL, verbose = TRUE)

Arguments

mcmc.set

Object of class bayesLife.mcmc.set.

thin, burnin

Thinning interval and burnin used for creating or identifying the thinned object.

output.dir

Directory for storing the thinned object. By default it is stored into the same directory as mcmc.set.

verbose

Logical switching log messages on and off.

Details

The function create.thinned.e0.mcmc is called from e0.predict and thus, the resulting object contains exactly the same MCMCs used for generating projections.

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 output.dir under the name ‘thinned_mcmc_t_b’ where t is the value of thin and b the value of burnin.

Value

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

Author(s)

Hana Sevcikova

See Also

bayesLife.mcmc.set, e0.predict

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
sim.dir <- tempfile()
m <- run.e0.mcmc(nr.chains = 2, iter = 60, thin = 2, output.dir = sim.dir, verbose = TRUE)
pr <- e0.predict(m, burnin = 40, predict.jmale = FALSE) # creates thinned MCMCs
mb <- get.thinned.e0.mcmc(m, thin = 2, burnin = 40)
summary(mb, meta.only = TRUE) # length 20 = 2chains x (60-40)iters./2thin

# the same chain as 
summary(pr$mcmc.set, meta.only = TRUE)

unlink(sim.dir, recursive=TRUE)
## End(Not run)

bayesLife documentation built on April 5, 2021, 5:06 p.m.