plot_gamma_poisson | R Documentation |
Consider a Gamma-Poisson Bayesian model for rate parameter λ with a Gamma(shape, rate) prior on λ 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 )
shape |
non-negative shape parameter of the Gamma prior |
rate |
non-negative rate parameter of the Gamma prior |
sum_y |
sum of observed data values for the Poisson likelihood |
n |
number of observations for the Poisson likelihood |
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. |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.