traceplot.cat_gibbs: Traceplot for Gibbs Sampling Model

View source: R/plots.R

traceplot.cat_gibbsR Documentation

Traceplot for Gibbs Sampling Model

Description

This function generates a traceplot for the Gibbs sampling model, which is typically used for posterior sampling in a Bayesian context. The traceplot visualizes the evolution of parameter values across Gibbs sampling iterations. It helps to diagnose the convergence and mixing of the chains.

Usage

## S3 method for class 'cat_gibbs'
traceplot(object, pars = NULL, inc_warmup = FALSE, ...)

Arguments

object

A fitted model object of class cat_gibbs that contains Gibbs sampling results. The object must include gibbs_iteration_log, which holds the iteration logs for all sampled parameters, and warmup and iter which indicate the warmup and total iteration counts, respectively.

pars

A character vector specifying the parameter names to plot. If NULL, the function will select the first 9 parameters automatically.

inc_warmup

A logical value indicating whether to include warmup iterations in the traceplot. If TRUE, warmup iterations are included, otherwise they are excluded. Defaults to FALSE.

...

Additional parameters to pass to other functions.

Details

The function generates a series of line plots for the selected parameters, displaying their values over the iterations of the Gibbs sampling process. If inc_warmup is set to TRUE, the traceplot includes the warmup period, otherwise, it starts after the warmup. The traceplots are arranged in a 3x3 grid, and no more than 9 parameters can be selected for plotting at once.

Value

A series of traceplots for the selected parameters, showing their evolution over the Gibbs sampling iterations.


catalytic documentation built on April 4, 2025, 5:51 a.m.