visualize_results: Visualize MCMC results

View source: R/diagnostics.R

visualize_resultsR Documentation

Visualize MCMC results

Description

Produces trace plots, marginal densities and joint plots depending on the dimension of the parameter space.

Usage

visualize_results(
  samples,
  true_values = NULL,
  title = "Results",
  burnin_frac = 0.2,
  true_covariance = NULL,
  show_acf = TRUE
)

Arguments

samples

Matrix of MCMC samples.

true_values

Optional vector of true parameter values.

title

Plot title.

burnin_frac

Burn-in fraction.

true_covariance

Optional true covariance matrix.

show_acf

Logical; whether to display autocorrelation plots.

Examples

log_post <- function(x) dnorm(x, log = TRUE)
res <- twalk(log_post, n_iter = 2000, x0 = -2, xp0 = 2)
visualize_results(
  res$all_samples,
  true_values = 0,
  title = "Standard normal"
)


Rtwalk documentation built on Feb. 5, 2026, 5:07 p.m.