Learn R Programming

Rtwalk (version 2.0.1)

visualize_results: 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

Run this code
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"
)

Run the code above in your browser using DataLab