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.
plot_beta_binomial(
alpha,
beta,
y = NULL,
n = NULL,
prior = TRUE,
likelihood = TRUE,
posterior = TRUE
)
positive shape parameters of the prior Beta model
observed number of successes
observed number of trials
a logical value indicating whether the prior model should be plotted
a logical value indicating whether the scaled likelihood should be plotted
a logical value indicating whether posterior model should be plotted
a ggplot
plot_beta_binomial(alpha = 1, beta = 13, y = 25, n = 50)
plot_beta_binomial(alpha = 1, beta = 13, y = 25, n = 50, posterior = FALSE)