Learn R Programming

bayou (version 2.1.1)

pull.pars: Utility function for retrieving parameters from an MCMC chain

Description

Utility function for retrieving parameters from an MCMC chain

Usage

# S3 method for pars
pull(i, chain, model = "OU")

Arguments

i

An integer giving the sample to retrieve

chain

A bayouMCMC chain

model

The parameterization used, either "OU", "QG" or "OUrepar"

Value

A bayou formatted parameter list

Examples

Run this code
# NOT RUN {
tree <- sim.bdtree(n=30)
tree$edge.length <- tree$edge.length/max(branching.times(tree))
prior <- make.prior(tree, dists=list(dk="cdpois", dsig2="dnorm", 
             dtheta="dnorm"), 
               param=list(dk=list(lambda=15, kmax=32), 
                 dsig2=list(mean=1, sd=0.01), 
                   dtheta=list(mean=0, sd=3)), 
                     plot.prior=FALSE)
pars <- priorSim(prior, tree, plot=FALSE, nsim=1)$pars[[1]]
dat <- dataSim(pars, model="OU", phenogram=FALSE, tree)$dat
fit <- bayou.mcmc(tree, dat, model="OU", prior=prior, 
             new.dir=TRUE, ngen=5000, plot.freq=NULL)
chain <- load.bayou(fit, save.Rdata=TRUE, cleanup=TRUE)
plotBayoupars(pull.pars(300, chain), tree)
# }

Run the code above in your browser using DataLab