traceplot {SANple}R Documentation

Traceplot: plot MCMC chains

Description

Check the convergence of the MCMC through visual inspection of the chains.

Usage

traceplot(object, params, 
          show_density = TRUE, 
          show_burnin = TRUE, 
          length_burnin = NULL, 
          show_convergence = TRUE, 
          trunc_plot = 10)

Arguments

object

object of class SANmcmc (the result of a call to sample_fiSAN, sample_fiSAN_sparsemix, sample_fSAN, sample_fSAN_sparsemix, or sample_CAM).

params

vector of strings with the names of the parameters to check.

show_density

logical (default TRUE). Whether a kernel estimate of the density should be plotted. The burn-in is always discarded.

show_burnin

logical (default TRUE). Whether the first part of the chains should be plotted in the traceplots.

length_burnin

if show_burnin = FALSE, the length of the burn-in to be discarded.

show_convergence

logical (default TRUE). Whether a superimposed red line of the cumulative mean should be plotted.

trunc_plot

integer (default = 10). For multidimensional parameters, the maximum number of components to be plotted.

Value

The function displays the traceplots of the MCMC algorithm.

Note

The function is not available for the observational weights \omega.

Examples

set.seed(123)
y <- c(rnorm(40,0,0.3), rnorm(20,5,0.3))
g <- c(rep(1,30), rep(2, 30))
out <- sample_fiSAN(nrep = 500, burn = 200, 
                    y = y, group = g, 
                    nclus_start = 2,
                    maxK = 20, maxL = 20,
                    beta = 1)
traceplot(out, params = c("mu", "sigma2"), trunc_plot = 2)



[Package SANple version 0.1.1 Index]