PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/working/auteur.extended/man/tracer.Rd

http://github.com/eastman/auteur
Unknown | 39 lines | 35 code | 4 blank | 0 comment | 0 complexity | 41c1df67e53d8dc8133dd0538a8d09d4 MD5 | raw file
 1\name{tracer}
 2\alias{tracer}
 3\title{plotting of Bayesian posterior samples }
 4\description{
 5Generates diagnostics for reversible-jump Markov sampling densities}
 6\usage{tracer(base.log, lambdaK = log(2), Bayes.factor = NULL, burnin = 0.25, col.line = 1, pdf = TRUE, factor="M",...)}
 7\arguments{
 8  \item{base.log}{a path to the stored summary logfile of the Markov sample}
 9  \item{lambdaK}{the shape parameter for the Poisson distribution used as a prior on the number of distinct rates in the tree (see \code{\link[stats]{rpois}})}
10  \item{Bayes.factor}{a vector of two numbers, specifying a Bayes factor comparison between \code{j}- and \code{k}-rate models; alternatively, the argument 
11can be \code{Bayes.factor=c(1,"multi")} in which a comparison between a global-rate and multiple-rate model is made}
12  \item{burnin}{proportion of the chain to be treated as burnin (e.g., from 0 to 1); burnin is used for all plots but the trace of the log-likelihoods}
13  \item{col.line}{a color to be used for density plots (both for a \code{Bayes.factor} comparison and for the density of mean rates across the Markov sample)}
14  \item{pdf}{a logical switch that determines whether plots are written to .pdf (and stored within the stored Bayesian output)}
15  \item{factor}{either a character ("k" or "M") or \code{NULL}, which determines how likelihood trace axis is defined: in thousands (\code{k}) or millions (\code{M}) of generations}
16  \item{\dots}{further arguments to be passed to \code{\link{plot}}}
17}
18\value{
19if \code{pdf=TRUE}, a .pdf will be generated that includes the trace of log-likelihoods, the density of sampled mean rates, the 
20correspondence between prior and posterior weights for \code{k}-rate models, and a Bayes factor comparison }
21\author{JM Eastman}
22\examples{
23# generate tree
24n=24
25phy=prunelastsplit(birthdeath.tree(b=1,d=0,taxa.stop=n+1))
26
27# simulate data 
28dat=rTraitCont(phy=phy, model="BM", sigma=sqrt(0.1))
29
30# run reversible-jump MCMC for a short chain
31r=paste(sample(letters,9,replace=TRUE),collapse="")
32rjmcmc.bm(phy=phy, dat=dat, ngen=10000, sample.freq=10, prob.mergesplit=0.1, fileBase=r)
33
34# plot Markov sampled rates and other traces
35tracer(base.log=paste(paste("BM",r,"parameters",sep="."),paste("BM",r,"rjmcmc.log",sep="."),sep="/"), lambdaK=log(2), Bayes.factor=c(1,"multi"), burnin=0.25, pdf=FALSE, factor="k")
36
37## PASTE UNCOMMENTED FOLLOWING LINE TO DROP DIRECTORIES CREATED BY RJMCMC
38 # unlink(dir(pattern=paste(r)),recursive=TRUE)
39}