R: Monte Carlo Simulation from a Poisson Likelihood with a Gamma...
MCpoissongamma
R Documentation
Monte Carlo Simulation from a Poisson Likelihood with a Gamma Prior
Description
This function generates a sample from the posterior distribution
of a Poisson likelihood with a Gamma prior.
Usage
MCpoissongamma(y, alpha, beta, mc=1000, ...)
Arguments
y
A vector of counts (must be non-negative).
alpha
Gamma prior distribution shape parameter.
beta
Gamma prior distribution scale parameter.
mc
The number of Monte Carlo draws to make.
...
further arguments to be passed
Details
MCpoissongamma directly simulates from the posterior distribution.
This model is designed primarily for instructional use. lambda
is the parameter of interest of the Poisson distribution.
We assume
a conjugate Gamma prior:
lambda ~ Gamma(alpha, beta)
y is a vector of counts.
Value
An mcmc object that contains the posterior sample. This
object can be summarized by functions provided by the coda package.