plotChains: Produces trace plots for a Bayesian mixture model

Description Usage Arguments Details Author(s) See Also Examples

Description

This function method draws trace plots for a Bayesian mixture model, e.g. visualizes the course of the Markov Chains. Inspection of the Markov Chains is important to determine convergence of the chains, which is necessary for sensible results.

Usage

1
plotChains(object, chain, component, itb = 1, thin = 1, cols, ...)

Arguments

object

An object of MixModelBayes-class

chain

A character of length one giving the name of the paramter, which chain should be plotted. Can be omitted, if component is given. Then, all parameters of the given components are plotted.

component

An integer specifying the components, which parameter chains should be plotted. Can be omitted, if chain is given. Then, all trace plots are generated for all components having the parameter specified via argument chain.

itb

Number of iterations used for burn-in. The burn-in is relative to the output of bayesMixModel, e.g., any burn-in specified here is added to the burn-in that was specified when calling bayesMixModel.

thin

Thinning value for the iterations after burn-in. The thinning is relative to the output of bayesMixModel, e.g., any thinning specified here multiplies by the thinning that was specified in bayesMixModel.

cols

Number of columns to be used in the plot. Optional, if omitted, the number of columns and rows are choosen be the method itself.

...

Further arguments passed to plot.

Details

The number of iterations necessary until a Markov chain reaches stationarity depends on the specific model and data. For any inference based on Markov Chain Monte Carlo methods, it is therefore necessary to inspect the convergence of Markov Chains. One way to do this is visual inspection of trace plots using this method.

If argument main is passed to this method, it should have as many elements as chains are plotted. Otherwise, vector main is reapted.

Author(s)

Hans-Ulrich Klein (h.klein@uni-muenster.de) Martin Schaefer (martin.schaefer@udo.edu)

See Also

bayesMixModel, MixModelBayes-class

Examples

1
2
3
4
5
6
7
8
9
z <- c(rnorm(1000, 0, 3), rnorm(1000, 0, 5), rexp(1000, 5), -rexp(1000, 5))
mm <- bayesMixModel(z, normNull=1:2, expNeg=3, expPos=4,
  sdNormNullInit=c(1, 2), rateExpNegInit=8, rateExpPosInit=8,
  shapeNorm0=c(1, 1), scaleNorm0=c(1, 1),
  shapeExpNeg0=c(1, 1), scaleExpNeg0=c(1, 1),
  shapeExpPos0=c(1, 1), scaleExpPos0=c(1, 1),
  sdAlpha=1, itb=200, nmc=1000, thin=10)
plotChains(mm, chain="pi")
plotChains(mm, component=c(2,3))

epigenomix documentation built on Nov. 8, 2020, 5:24 p.m.