stan_trace: Plot the MCMC posterior draws by chain

stan_traceR Documentation

Plot the MCMC posterior draws by chain

Description

This function allows you to produce trace plots for assessing the quality and convergence of MCMC chains.

Usage

stan_trace(object, ...)

Arguments

object

A fitted idealstan model

...

Other options passed on to stan_trace

Details

To use this function, you must pass a fitted idealstan object along with the name of a parameter in the model. To determine these parameter names, use the summary function or obtain the data from a plot by passing the return_data=TRUE option to id_plot_persons or id_plot_persons_dyn to find the name of the parameter in the Stan model.

This function is a simple wrapper around mcmc_trace. Please refer to that function's documentation for further options.

Value

A ggplot2 object (from mcmc_trace) showing MCMC trace plots for the selected parameter.

Examples


data('senate114')
senate114$cast_code <- ifelse(senate114$cast_code=="Absent", NA,
                              as.integer(senate114$cast_code) - 1L)
sen_data <- id_make(senate114, outcome_disc='cast_code',
                    person_id='bioname', item_id='rollnumber',
                    group_id='party_code')
sen_est <- id_estimate(sen_data, model_type=1, 
           fixtype='vb_full', use_method="pathfinder", ncores=4)
stan_trace(sen_est, par='L_full[1]')


idealstan documentation built on May 13, 2026, 1:08 a.m.