get.e0.parameter.traces: Accessing MCMC Parameter Traces

Description Usage Arguments Value Author(s) See Also Examples

View source: R/get_outputs.R

Description

Functions for accessing traces of the MCMC parameters, either country-independent or country-specific.

Usage

1
2
3
4
5
get.e0.parameter.traces(mcmc.list, par.names = NULL, 
    burnin = 0, thinning.index = NULL, thin = NULL)
    
get.e0.parameter.traces.cs(mcmc.list, country.obj, 
    par.names = NULL, burnin = 0, thinning.index = NULL, thin = NULL)

Arguments

mcmc.list

List of bayesLife.mcmc objects.

country.obj

Country object list (see get.country.object).

par.names

Names of country-independent parameters (in case of get.e0.parameter.traces) or country-specific parameters (in case of get.e0.parameter.traces.cs) to be included. By default all parameters are included.

burnin

Burn-in indicating how many iterations should be removed from the beginning of each chain.

thinning.index

Index of the traces for thinning. If it is NULL, thin is used. thinning.index does not include burnin and should be flattened over all chains. For example, if there are two MCMC chains of length 1000, burnin=200 and we want a sample of length 400, then the value should be thinning.index=seq(1,1600, length=400).

thin

Alternative to thinning.index. The above example is equivalent to thin=4.

Value

Both functions return a matrix with columns being the parameters and rows being the MCMC values, attached to one another in case of multiple chains. get.e0.parameter.traces returns country-independent parameters, get.e0.parameter.traces.cs returns country-specific parameters.

Author(s)

Hana Sevcikova

See Also

e0.coda.list.mcmc for another way of retrieving parameter traces.

Examples

1
2
3
4
5
6
7
8
9
sim.dir <- file.path(find.package("bayesLife"), "ex-data", "bayesLife.output")
m <- get.e0.mcmc(sim.dir)
e0.values <- get.e0.parameter.traces(m$mcmc.list, burnin = 10, par.names = "z")
hist(e0.values, main = colnames(e0.values))

e0.values.cs <- get.e0.parameter.traces.cs(m$mcmc.list, 
                    get.country.object("Canada", meta = m$meta),
                    burnin = 10, par.names = "z.c")
hist(e0.values.cs, main = colnames(e0.values.cs))

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