ggChains {CNPBayes} | R Documentation

## Trace plots of MCMC chains and mixture model densities

### 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

    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

      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)

[Package CNPBayes version 1.13.5 Index]