Skip to contents

Plot posterior distribution of given parameters

Usage

plot_posterior(
  abc,
  param = NULL,
  posterior = c("adj", "unadj"),
  facets = FALSE,
  file = NULL,
  ...
)

Arguments

abc

ABC object generated by run_abc

param

A character vector containing either parameter names to summarize, or a regex-like matches to be used for subsetting. If NULL (the default), all parameters will be extracted.

posterior

Should an "adj"-usted or "unadj"-usted posterior be extracted? (Default is "adj").

facets

Should individual distributions be plotted in separate facets? Default is FALSE.

file

Output file for a figure saved via ggsave

...

Optional argument which will be passed to ggsave

Value

A ggplot2 plot object

Examples

# read an example result of an ABC inference
abc_res <- readRDS(system.file("examples/basics_abc.rds", package = "demografr"))

# plotting posteriors of all parameters at once doesn't make much sense
# plot_posterior(abc_res)

# this is better
plot_posterior(abc_res, facets = TRUE)


# this is perhaps even better
# plot_posterior(abc_res, param = "^Ne_")