plot_gamma_poisson {bayesrules}R Documentation

Plot a Gamma-Poisson Bayesian Model

Description

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.

Usage

plot_gamma_poisson(
  shape,
  rate,
  sum_y = NULL,
  n = NULL,
  prior = TRUE,
  likelihood = TRUE,
  posterior = TRUE
)

Arguments

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.

Value

a ggplot

Examples

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)

[Package bayesrules version 0.0.2 Index]