ggplot-functions: Trace plots of MCMC chains and mixture model densities

Description Usage Arguments Details Value See Also Examples

Description

The ggChains method provides a convenient wrapper for plotting the chains of all parameters in the various mixture model implementations. In addition to the estimated number of independent MCMC draws (effective sample size) and Gelman-Rubin convergence diagnostics implemented in gibbs, visualization of the chains is helpful for assessing convergence.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ggChains(model)

ggMixture(model, bins = 100)

## S4 method for signature 'MultiBatchCopyNumber'
ggMixture(model, bins = 100)

## S4 method for signature 'MultiBatchCopyNumberPooled'
ggMixture(model, bins = 100)

## S4 method for signature 'MultiBatchModel'
ggMixture(model, bins = 100)

## S4 method for signature 'MultiBatch'
ggMixture(model, bins = 100)

## S4 method for signature 'MultiBatchPooled'
ggMixture(model, bins = 100)

## S4 method for signature 'MultiBatchModel'
ggChains(model)

## S4 method for signature 'MultiBatchPooled'
ggChains(model)

Arguments

model

A SB, MB, SBP, or MBP model

bins

a length-one numeric vector indicating the number of bins – passed to geom_hist

Details

The ggMixture method overlays the density of the posterior predictive distribution of the Gaussian mixture on the empirical data. ggMixture assumes that you have already run the Gibbs sampler either by the gibbs function or by the posteriorSimulation function.

Value

A gg object

See Also

gibbs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  sb <- SingleBatchModelExample
  iter(sb) <- 1000
  burnin(sb) <- 100
  sb <- posteriorSimulation(sb)
  fig.chains <- ggChains(sb)
  ## component-specific chains
  fig.chains[["comp"]]
  ## single-parameter chains and log-likelihood
  fig.chains[["single"]]

  ## plot the mixture
  fig.mix <- ggMixture(sb)
data(MultiBatchModelExample)
fig <- ggMixture(MultiBatchModelExample)

CNPBayes documentation built on May 6, 2019, 4:06 a.m.