samplesPlot: Plot MCMC traceplots and density plots

Description Usage Arguments Examples

View source: R/plots.R

Description

Plot MCMC traceplots and density plots

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
samplesPlot(
  samples,
  var = colnames(samples),
  ind = NULL,
  burnin = NULL,
  scale = FALSE,
  line = NULL,
  width = 7,
  height = 4,
  legend = TRUE,
  legend.location = "topright",
  traceplot = TRUE,
  densityplot = TRUE,
  file = NULL
)

Arguments

samples

Array of MCMC samples, or a list of samples from multiple chains in which case the first chain is used

var

Parameter names to plot

ind

Indices of MCMC samples to plot

burnin

Number of initial MCMC samples to discard (default: 0)

scale

Logical, whether to normalize each posterior chain

line

Numeric vector of true parameter values for adding lines to plots

width

Width of the plot

height

Height of the plot

legend

Logical, whether to include a legend of parameter names

legend.location

Location of legend

traceplot

Logical, whether to include traceplots (default: TRUE)

densityplot

Logaical, whether to include density plots (default: TRUE)

file

Optional filename to save figure as a file

Examples

1
2
3
samples <- cbind(rnorm(1000), rgamma(1000, 1))
colnames(samples) <- c('alpha', 'beta')
samplesPlot(samples)

basicMCMCplots documentation built on Nov. 5, 2021, 1:08 a.m.