readMCMC: Read the MCMC output files

View source: R/readMCMC.R

readMCMCR Documentation

Read the MCMC output files

Description

Reads the output files from the MCMC with the posterior distribution of the chains.

Usage

readMCMC(handle, burn = 0, thin = 1, dir = NULL)

Arguments

handle

the output object from the 'ratematrixMCMC' function.

burn

the proportion of the burnin to be pruned from the MCMC chain. A number between 0 and 1 (default is 0).

thin

the thinning of the posterior distribution. A number with the interval between each MCMC step to be kept in the posterior distribution (default is 1).

dir

directory with the output files. If 'NULL' (default), then files are read from the directory chosen when running the MCMC chain using the argument 'dir' of the 'ratematrixMCMC' function (stored on handle). Otherwise function will read files from 'dir'.

Value

List with the MCMC chain for the phylogenetic mean (root value) and evolutionary rate matrices (R). *root* are the values for the phylogenetic mean in matrix format; *matrix* is a list of length equal to the number of rate regimes fitted to the tree, each of those are lists with the chain of respective R matrices.

Author(s)

Daniel S. Caetano and Luke J. Harmon

Examples


## Load data
data(centrarchidae)
## Run MCMC. This is just a very short chain.
handle <- ratematrixMCMC(data=centrarchidae$data, phy=centrarchidae$phy.map, gen=10000
                         , dir=tempdir())
## Load posterior distribution.
## We can set the burn-in value and the thinning.
posterior <- readMCMC(handle, burn=0.25, thin=1)


Caetanods/ratematrix documentation built on Jan. 4, 2023, 3:12 p.m.