Consider a Gamma-Poisson Bayesian model for rate parameter \(\lambda\) with a Gamma(shape, rate) prior on \(\lambda\) and a Poisson likelihood for the data. Given information on the prior (shape and rate) and data (the sample size n and sum_y), 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_gamma_poisson(
shape,
rate,
sum_y = NULL,
n = NULL,
prior = TRUE,
likelihood = TRUE,
posterior = TRUE
)
non-negative shape parameter of the Gamma prior
non-negative rate parameter of the Gamma prior
sum of observed data values for the Poisson likelihood
number of observations for the Poisson likelihood
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_gamma_poisson(shape = 100, rate = 20, sum_y = 39, n = 6)
plot_gamma_poisson(shape = 100, rate = 20, sum_y = 39, n = 6, posterior = FALSE)