Learn R Programming

synlik (version 0.1.6)

plot-smcmc: Plotting objects of class smcmc.

Description

Method for plotting an object of class smcmc.

Usage

# S4 method for smcmc,missing
plot(x, trans = NULL, addPlot1 = NULL,
  addPlot2 = NULL, ...)

Arguments

x

An object of class smcmc.

trans

Name list or vector containing names of transforms for some parameters (ex: list("par1" = "exp", "par2" = "log")). The transformations will be applied before plotting.

addPlot1

Name of additional plotting function that will be call after the MCMC chain have been plotted. It has to have prototype fun(nam, ...) where nam will be the parameter name. See "examples".

addPlot2

Name of additional plotting function that will be call after the histograms have been plotted. It has to have prototype fun(nam, ...) where nam will be the parameter name. See "examples".

...

additional arguments to be passed to the plotting functions.

See Also

smcmc-class, plot.

Examples

Run this code
data(ricker_smcmc)

# Functions for additional annotations (true parameters)
addline1 <- function(parNam, ...){ 
               abline(h = exp(ricker_smcmc@param[parNam]), lwd = 2, lty = 2, col = 3) 
               }
addline2 <- function(parNam, ...){ 
               abline(v = exp(ricker_smcmc@param[parNam]), lwd = 2, lty = 2, col = 3)
               }

# Transformations (exponentials)
trans <- rep("exp", 3)
names(trans) <- names(ricker_smcmc@param)

plot(ricker_smcmc, 
     trans = trans,
     addPlot1 = "addline1", 
     addPlot2 = "addline2")

Run the code above in your browser using DataLab