| calculate_diagnostics | R Documentation |
Computes posterior summaries (mean, SD, quantiles) and effective sample sizes after discarding a burn-in fraction.
calculate_diagnostics(
samples,
burnin_frac = 0.2,
param_names = NULL,
title = ""
)
samples |
Matrix of MCMC samples (iterations x parameters). |
burnin_frac |
Fraction of samples to discard as burn-in. |
param_names |
Optional character vector of parameter names. |
title |
Optional title for printed output. |
A data frame with posterior summaries and effective sample sizes.
log_post <- function(x) dnorm(x, log = TRUE)
res <- twalk(log_post, n_iter = 2000, x0 = -2, xp0 = 2)
calculate_diagnostics(
res$all_samples,
burnin_frac = 0.2,
param_names = "theta",
title = "Standard normal"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.