plotDiagnostics: Diagnostic graphics for MCMC output

Description Usage Arguments Value Author(s) See Also Examples

Description

Display trace plots, density plots or autocorrelation plots for the chains in the MCMC output. Each chain is plotted with a different colour.

Usage

1
2
3
4
5
6
7
diagPlot(object, which, ask=TRUE, maxRow=4, RhatBad=1.05, ...)

tracePlot(object, ask=TRUE, ...)

densityPlot(object, ask=TRUE, ...)

acfPlot(object, lag.max=NULL, ask=TRUE, ...)

Arguments

object

An object of class Bwiqid.

which

An optional vector of parameter names or numbers.

ask

If TRUE, the user will be prompted before the next page of output is displayed.

maxRow

Maximum number of rows to display in one window; each row consists of a trace plot and a density plot for one parameter.

RhatBad

Threshold for Rhat; parameters with Rhat > RhatBad are highlighted in red.

lag.max

Maximum lag at which to calculate the acf; see acf.

...

Additional graphical parameters.

Value

Return NULL invisibly. Used for their plotting side-effects.

Author(s)

Mike Meredith

See Also

plotPost for a histogram and summary statistics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Create a fake Bwiqid object:
fake <- data.frame(
  mu0 = rnorm(3000),        # normal, mean zero
  mu10 = rnorm(3000, 10),   # normal, mean 10
  sigma=rlnorm(3000),       # non-negative, skewed
  prob = rbeta(3000, 2,2),  # probability, central mode
  prob0 = rbeta(3000, 1,2), # probability, mode = 0
  N = rpois(3000, 20),      # large integers (no zeros)
  n = rpois(3000, 2),       # small integers (some zeros)
  const1 = rep(1, 3000),    # all values = 1
  const3.2 = rep(3.2, 3000))# all values the same but not integer
class(fake) <- c("Bwiqid", "data.frame")
attr(fake, "n.chains") <- 3
attr(fake, "Rhat") <- c(1, 1.01, 1.05, 1.1, 1.2, 1, NA, 1, NA)

fake
diagPlot(fake)
par(mfrow=c(3,3))
tracePlot(fake)
densityPlot(fake, col=1:5, lwd=2)
acfPlot(fake, lag.max=10)
par(mfrow=c(1,1))

wiqid documentation built on Nov. 19, 2017, 9:02 a.m.