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.
# S3 method for cat_gibbs
traceplot(object, pars = NULL, inc_warmup = FALSE, ...)
A series of traceplots for the selected parameters, showing their evolution over the Gibbs sampling iterations.
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.
A character vector specifying the parameter names to plot.
If NULL
, the function will select the first 9 parameters automatically.
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.
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.