| plot.mcmc_dm | R Documentation |
mcmc_dm ObjectsVisualize MCMC results and diagnostics for mcmc_dm objects.
The function plot.mcmc() is typically called when users supply an
mcmc_dm object returned by estimate_dm() to the generic
base::plot() function.
## S3 method for class 'mcmc_dm'
plot(x, ..., id = NULL, what = "trace", bundle_plots = TRUE)
x |
an object of class |
... |
optional arguments passed on to the underlying plotting functions
|
id |
optional character vector, specifying the id(s) of participants to
plot. If |
what |
a character string indicating the type of plot to produce. Must
be either |
bundle_plots |
logical, indicating whether to display separate panels
in a single plot layout ( |
This function provides diagnostic and summary visualizations of MCMC samples. It handles results from both hierarchical and non-hierarchical MCMC runs:
If id is provided, the plot refers to the requested participant, with
MCMC results extracted at the individual level.
If id is omitted, plots refer to group-level parameters (i.e., the
hyperparameters)
The following plot types are supported:
Trace plots (what = "trace"): These plots show sampled parameter values
across MCMC iterations for each
chain. They are primarily used to inspect convergence and mixing behavior.
Ideally, all chains should appear well-mixed (i.e., they should overlap and
sample in a similar range). Lack of convergence is indicated by chains that
remain in separate regions or exhibit trends over time.
Density plots (what = "density"): These plots display smoothed marginal
posterior distributions for each
parameter, collapsed over chains and iterations. They are useful for
understanding the central tendency, variance, and shape of the posterior
distributions.
Autocorrelation plots (what = "auto"): These plots display the
autocorrelation at different lags, averaged across chains.
They are useful to judge how quickly the chains produced independent samples.
Returns NULL invisibly.
plot_mcmc_trace(), plot_mcmc_marginal(),
plot_mcmc_auto()
# get an examplary `mcmc_dm` object
chains_obj <- get_example_fits("mcmc")
plot(chains_obj)
plot(chains_obj, what = "density")
plot(chains_obj, what = "density", which_prm = "b", bundle_plots = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.