Learn R Programming

see (version 0.5.1.1)

plot.see_estimate_density: Plot method for density estimation of posterior samples

Description

The plot() method for the bayestestR::estimate_density() function.

Usage

# S3 method for see_estimate_density
plot(
  x,
  stack = TRUE,
  show_intercept = FALSE,
  n_columns = 1,
  priors = FALSE,
  priors_alpha = 0.4,
  size = 0.9,
  ...
)

Arguments

x

An object.

stack

Logical, if TRUE, densities are plotted as stacked lines. Else, densities are plotted for each parameter among each other.

show_intercept

Logical, if TRUE, the intercept-parameter is included in the plot. By default, it is hidden because in many cases the intercept-parameter has a posterior distribution on a very different location, so density curves of posterior distributions for other parameters are hardly visible.

n_columns

For models with multiple components (like fixed and random, count and zero-inflated), defines the number of columns for the panel-layout. If NULL, a single, integrated plot is shown.

priors

Logical, if TRUE, prior distributions are simulated (using simulate_prior) and added to the plot.

priors_alpha

Alpha value of the prior distributions.

size

Size of geoms. Depends on the context of the plot() function, so this argument may change size of points, lines or bars.

...

Arguments passed to or from other methods.

Value

A ggplot2-object.

Examples

Run this code
# NOT RUN {
if (require("bayestestR") && require("rstanarm")) {
  set.seed(123)
  m <<- stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0)
  result <- estimate_density(m)
  plot(result)
}
# }

Run the code above in your browser using DataLab