bayesLife.mcmc: MCMC Simulation Object

Description Details Value Author(s) See Also Examples

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.

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.

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, …, Delta_4 and lambda_1, … 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, …, Delta^c_4 with four values for each country, i.e. an 4 x 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 x 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(s)

Hana Sevcikova

See Also

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

Examples

1
2
3
4
5
6
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)

Example output

Loading required package: bayesTFR
[1]   20 1081

Simulation: Female life expectancy
WPP: 2017
Input data: e0 for period 1950 - 2015 

MCMC parameters estimated for 178 countries.
Hyperparameters estimated using 178 countries.

Iterations = 41:60
Thinning interval = 1 
Number of chains = 1 
Sample size per chain = 20 

1. Empirical mean and standard deviation for each variable,
   plus standard error of the mean:

               Mean       SD  Naive SE Time-series SE
Triangle_1 13.72030 0.297097 0.0664330       0.034677
Triangle_2 36.82729 0.412954 0.0923393       0.068893
Triangle_3  4.86570 0.396728 0.0887112       0.088711
Triangle_4 22.50276 0.749207 0.1675277       0.145400
k           3.91313 0.121196 0.0271003       0.055204
z           0.63580 0.016775 0.0037509       0.003855
lambda_1    0.04335 0.005229 0.0011692       0.001961
lambda_2    0.03166 0.005175 0.0011572       0.001157
lambda_3    0.06205 0.009305 0.0020806       0.004341
lambda_4    0.01384 0.002117 0.0004733       0.000779
lambda.k    0.71394 0.133727 0.0299024       0.067869
lambda.z   25.18623 6.209974 1.3885923       3.300401
omega       1.55776 0.032340 0.0072315       0.010721

2. Quantiles for each variable:

               2.5%      25%      50%      75%    97.5%
Triangle_1 13.15204 13.52562 13.75217 13.87111 14.13987
Triangle_2 36.08804 36.54218 36.89442 37.01266 37.60935
Triangle_3  4.16723  4.64106  4.80526  5.15549  5.51592
Triangle_4 21.20053 21.86046 22.57526 23.02368 23.69498
k           3.69603  3.82895  3.92086  3.98817  4.10938
z           0.60002  0.62474  0.64217  0.64797  0.65189
lambda_1    0.03565  0.04027  0.04246  0.04512  0.05464
lambda_2    0.02339  0.02780  0.03207  0.03315  0.04224
lambda_3    0.04307  0.05855  0.06378  0.06912  0.07229
lambda_4    0.01047  0.01167  0.01453  0.01537  0.01718
lambda.k    0.52757  0.60650  0.69265  0.77487  0.99168
lambda.z   17.86577 19.65271 24.61667 28.88557 36.90628
omega       1.49920  1.53482  1.56052  1.57766  1.60451

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