plot_beta_binomial {bayesrules}R Documentation

Plot a Beta-Binomial Bayesian Model

Description

Consider a Beta-Binomial Bayesian model for parameter \pi with a Beta(alpha, beta) prior on \pi and Binomial likelihood with n trials and y successes. Given information on the prior (alpha and data) and data (y and n), this function produces a plot of any combination of the corresponding prior pdf, scaled likelihood function, and posterior pdf. All three are included by default.

Usage

plot_beta_binomial(
  alpha,
  beta,
  y = NULL,
  n = NULL,
  prior = TRUE,
  likelihood = TRUE,
  posterior = TRUE
)

Arguments

alpha, beta

positive shape parameters of the prior Beta model

y

observed number of successes

n

observed number of trials

prior

a logical value indicating whether the prior model should be plotted

likelihood

a logical value indicating whether the scaled likelihood should be plotted

posterior

a logical value indicating whether posterior model should be plotted

Value

a ggplot

Examples


plot_beta_binomial(alpha = 1, beta = 13, y = 25, n = 50)
plot_beta_binomial(alpha = 1, beta = 13, y = 25, n = 50, posterior = FALSE)


[Package bayesrules version 0.0.2 Index]