get.tfr.parameter.traces {bayesTFR}R Documentation

Accessing MCMC Parameter Traces

Description

Functions for accessing traces of the MCMC parameters, either country-independent or country-specific. Functions get.tfr.parameter.traces and get.tfr.parameter.traces.cs access Phase II MCMCs; Functions get.tfr3.parameter.traces and get.tfr3.parameter.traces.cs access Phase III MCMCs.

Usage

get.tfr.parameter.traces(mcmc.list, par.names = tfr.parameter.names(), 
    burnin = 0, thinning.index = NULL, thin = NULL)
    
get.tfr.parameter.traces.cs(mcmc.list, country.obj, 
    par.names=tfr.parameter.names.cs(), 
    burnin=0, thinning.index=NULL, thin=NULL)
    
get.tfr3.parameter.traces(mcmc.list, par.names = tfr3.parameter.names(), ...)
    
get.tfr3.parameter.traces.cs(mcmc.list, country.obj, 
    par.names=tfr3.parameter.names.cs(), ...)

Arguments

mcmc.list

List of bayesTFR.mcmc objects.

country.obj

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

par.names

Names of country-independent parameters (in case of get.tfr.parameter.traces) or country-specific parameters (in case of get.tfr.parameter.traces.cs) to be included.

burnin

Burnin 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. 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. In the above example it would be thin=4.

...

Arguments passed to underlying functions (i.e. to get.tfr.parameter.traces or get.tfr.parameter.traces.cs).

Value

All 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.tfr.parameter.traces and get.tfr3.parameter.traces return country-independent parameters, get.tfr.parameter.traces.cs and get.tfr3.parameter.traces.cs return country-specific parameters.

Author(s)

Hana Sevcikova

See Also

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

Examples

sim.dir <- file.path(find.package("bayesTFR"), "ex-data", "bayesTFR.output")
m <- get.tfr.mcmc(sim.dir)
tfr.values <- get.tfr.parameter.traces(m$mcmc.list, burnin=10, par.names="sigma0")
## Not run: 
hist(tfr.values, main=colnames(tfr.values))

## End(Not run)
tfr.values.cs <- get.tfr.parameter.traces.cs(m$mcmc.list, 
                    get.country.object("Canada", meta=m$meta),
                    burnin=10, par.names="Triangle_c4")
## Not run: 
hist(tfr.values.cs, main=colnames(tfr.values.cs))

## End(Not run)

[Package bayesTFR version 7.4-2 Index]