plot_mcmc_bite {bite}R Documentation

Plot trace and density from a log file

Description

This function plots the trace and/or density of each mcmc sample.

Usage

plot_mcmc_bite(mcmc.log, type = c("trace", "density"), burnin = 0,
  variable = NA, label = NA, col = "#000000", cex.est = 1,
  bty = "n", kp.burn = FALSE, ...)

Arguments

mcmc.log

Any mcmc sample with the saved iterations in rows and the variables in columns

type

Character taken in c("trace", "density"). If both are specified, they are plotted side by side in the same graphical device

burnin

The size of the burnin in number of iterations or the proportion of iteration you want to remove

variable

The name or number of the variable to plot. If is.na(variable), all columns of mcmc.log will be plotted except "iter" and "temperature"

label

Full variable name to be plotted

col, bty, ...

Other graphical parameters to parse to par

cex.est

The magnification to be used for estimates display

kp.burn

Logical specifying whether the plot window should adjust to the pre-burnin values (only evaluated if "trace" in type)

Author(s)

Theo Gaboriau

Examples


 ## Load test data
 data(Anolis_traits)
 data(Anolis_tree)
 data(Anolis_map)
 
 ## Run a simple MCMC chain
 my.jive <- make_jive(Anolis_tree, Anolis_traits[-3],  model.priors = list(mean="BM", logvar="OU"))
 bite_ex <- tempdir()
 logfile <- sprintf("%s/my.jive_mcmc.log", bite_ex)
 mcmc_bite(my.jive, log.file=logfile, sampling.freq=10, print.freq=10, ngen=1000) 

 ## import the results in R
 res <- read.csv(logfile, header = TRUE, sep = "\t")
 
 ## plot the results
 plot_mcmc_bite(res, burnin = 0.2, variable = NA, cex.est = .7)
 plot_mcmc_bite(res, burnin = 0.2, variable = "prior.mean", cex.est = .7)

[Package bite version 0.3 Index]