Skip to contents

Visualize marginal posterior distributions of parameters extracted from [ngme_sgld_samples()] or summarized by [ngme_sgld_ci()].

Usage

posterior_plot(
  x,
  parameters = NULL,
  type = c("density", "histogram"),
  by_chain = FALSE,
  show_estimate = TRUE,
  show_interval = TRUE,
  lower = NULL,
  upper = NULL,
  bins = 30,
  ncol = NULL,
  ...
)

# S3 method for class 'ngme_sgld_ci'
plot(x, ...)

Arguments

x

a data.frame (or list of data.frames) returned by [ngme_sgld_samples()], or an object of class `ngme_sgld_ci`.

parameters

optional character vector of parameter names to plot. Defaults to all parameter columns.

type

character; `"density"` (default) or `"histogram"`.

by_chain

logical; if `TRUE`, color distributions by chain when a `.chain` column is available.

show_estimate

logical; add a vertical line at the posterior mean.

show_interval

logical; add vertical lines for the equal-tail interval.

lower

lower quantile probability used for intervals. If `x` is an `ngme_sgld_ci` object, the stored value is used by default.

upper

upper quantile probability used for intervals. If `x` is an `ngme_sgld_ci` object, the stored value is used by default.

bins

number of bins for histograms.

ncol

number of facet columns. If `NULL`, use 2 columns for multiple parameters and 1 for a single parameter.

...

unused.

Value

A faceted ggplot object.