Learn R Programming

bayesLife (version 5.3-1)

bayesLife.mcmc: MCMC Simulation Object

Description

MCMC simulation object bayesLife.mcmc containing information about one MCMC chain. A set of such objects belonging to the same simulation together with a bayesLife.mcmc.meta object constitute a bayesLife.mcmc.set object.

Arguments

Value

A bayesLife.mcmc object contains parameters of the Bayesian hierarchical model, more specifically, their initial values (all names with the suffix .ini) and values from the last iteration. These are:

Triangle/Triangle.ini, lambda/lambda.ini - world parameters, containing four values each. They correspond to model parameters \(\Delta_1, \dots, \Delta_4\) and \(\lambda_1, \dots \lambda_4\), respectively.

k/k.ini, z/z.ini, omega/omega.ini, lambda.k/lambda.k.ini,

lambda.z/lambda.z.ini - world parameters, containing one value each. They correspond to model parameters \(k\), \(z\), \(\omega\), \(\lambda_k\), and \(\lambda_z\), respectively.

Triangle.c - country-specific parameter \(\Delta^c_1, \dots, \Delta^c_4\) with four values for each country, i.e. an \(4 \times C\) matrix where \(C\) is the number of countries.

k.c, z.c - country-specific parameters \(k^c\) and \(z^c\) (1d arrays of length \(C\)).

Furthermore, the object contains components:

iter

Total number of iterations the simulation was started with.

finished.iter

Number of iterations that were finished. Results from the last finished iteration are stored in the parameters above.

length

Length of the MCMC stored on disk. It differs from finished.iter only if thin is larger than one.

thin

Thinning interval used when simulating the MCMCs.

id

Identifier of this chain.

output.dir

Subdirectory (relative to output.dir in the bayesLife.mcmc.meta object) where results of this chain are stored.

traces

This is a placeholder for keeping whole parameter traces in the memory. If the processing operates in a low memory mode, it will be 0. It can be filled in using the function get.e0.mcmc(..., low.memory=FALSE). In such a case, traces is a \(I \times J\) array where \(I\) is the MCMC length and \(J\) is the number of parameters.

traces.burnin

Burnin used to retrieve the traces, i.e. how many stored iterations are missing from the beginning in the traces array comparing to the ‘raw’ traces on the disk.

rng.state

State of the random number generator at the end of the last finished interation.

meta

Object of class bayesLife.mcmc.meta used for simulation of this chain.

Author

Hana Sevcikova

Details

An object bayesLife.mcmc points to a place on disk (element output.dir) where MCMC results from all iterations are stored. They can be retrieved to the memory using get.e0.mcmc(...).

The object is in standard cases not to be manipulated by itself, but rather as part of a bayesLife.mcmc.set object.

See Also

run.e0.mcmc, get.e0.mcmc, bayesLife.mcmc.set, bayesLife.mcmc.meta

Examples

Run this code
sim.dir <- file.path(find.package("bayesLife"), "ex-data", "bayesLife.output")
# loads traces from one chain
m <- get.e0.mcmc(sim.dir, low.memory = FALSE, burnin = 40, chain.ids = 1)
# should have 20 rows, since 60 iterations in total minus 40 burnin
dim(e0.mcmc(m, 1)$traces)
summary(m)

Run the code above in your browser using DataLab