Visualize Draws from Prior or Posterior Distributions

vizdraws(
  prior = NULL,
  posterior = NULL,
  MME = 0,
  threshold = NULL,
  units = NULL,
  quantity = FALSE,
  tense = c("future", "past"),
  backgroundColor = "#FFFFFF",
  backgroundOpacity = 0.9,
  xlab = NULL,
  breaks = NULL,
  break_names = NULL,
  colors = NULL,
  width = NULL,
  height = NULL,
  xlim = NULL,
  font_scale = 1,
  display_mode_name = FALSE,
  title = "",
  stop_trans = FALSE,
  percentage = FALSE,
  elementId = NULL,
  logoPath = NULL,
  logoSize = 100,
  logoLocation = c("bottom-right", "top-left", "top-right", "bottom-left")
)

Arguments

prior

(optional) Prior distribution or draws from it. Supported distributions: `Normal`, `uniform`, `beta`, and `gamma`. Provide either this or the posterior.

posterior

(optional) Draws from the posterior distribution. Provide either this or the prior.

MME

Minimum meaningful effect. If not provided, MME is set to zero.

threshold

If the probability is greater than this threshold, a decision is considered comfortable.

units

Optional argument to specify the units of x (e.g., dollars or applications).

quantity

Defaults to FALSE. When set to true, the text will reflect predicting a quantity rather than a treatment effect.

tense

Either "future" or "past." This is the tense used in the description if quantity is set to TRUE. NULL.

backgroundColor

Defaults to '#FFFFFF'.

backgroundOpacity

Defaults to 0.9.

xlab

Defaults to NULL.

breaks

Defaults to NULL.

break_names

Defaults to NULL.

colors

Colors for the left, middle, and right areas. Defaults to c("#e41a1c", "#377eb8", "#4daf4a").

width

Width for shiny.

height

Height for shiny.

xlim

Defaults to NULL.

font_scale

Defaults to 1.

display_mode_name

Defaults to FALSE.

title

Defaults to ''.

stop_trans

Defaults to FALSE. When set to true, the initial transition stops at posterior density.

percentage

Defaults to FALSE. When set to true, the x-axis tick format will be set to percentage.

elementId

Use an explicit element ID for the widget (rather than an automatically generated one). elementID for shiny.

logoPath

Logo path. Defaults to NULL.

logoSize

Logo size. Defaults to FALSE.

logoLocation

Logo location. c('bottom-right', 'top-left', 'top-right', 'bottom-left').

Value

A HTML widget object.

Details

A function to visualize draws from either the prior or posterior distribution, facilitating interpretation and decision-making.

Examples

if(interactive()){
  set.seed(9782)
  library(vizdraws)
  vizdraws(prior = rnorm(100000))
}