poisgamma: Poisson sampling distribution with a gamma distribution of...

Description Usage Arguments Value Source References See Also Examples

Description

Define the posterior distribution function for π ( μ | x ), with a gamma prior distribution π ( μ; α, λ ) and a poisson sampling distribution f (x | μ).

Usage

1
poisgamma(x, shape, rate, scale = 1/rate)

Arguments

x

the sample data from poisson distribution (x > 0).

shape

the shape parameter for a gamma distribution (> 0).

rate

the rate parameter for a gamma distribution (> 0).

scale

equals 1 / rate (> 0).

Value

An object of class "g12post" is returned.

prior

the prior distribution, i.e. the gamma(α,λ) distribution.

likelihood

the likelihood function of x given μ, i.e. the Poisson( x | μ) distribution.

posterior

the posterior distribution of μ given x.

mu

the expected number of occurence which is the parameter of poisson distribution.

pri.shape

the shape parameter for the gamma distribution of prior.

pri.rate

the rate parameter for the gamma distribution of prior.

pos.shape

the shape parameter for the gamma distribution of posterior.

pos.rate

the rate parameter for the gamma distribution of posterior.

model

the prior and likelihood type to produce the posterior.

Source

STATG012 slides5 Example5.6 on Moodle at UCL STATG012 slides5

References

Bolstad, W.M. 2007. Introduction to Bayesian Statistics. (2nd ed.). Hoboken, New Jersey: John Wiley & Sons, Inc.

See Also

summary.g12post for summararies of prior and posterior distribution.

plot.g12post for plots of prior and posterior distribution.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## an observation of 10 with an exponential prior
a <- poisgamma(10, 1, 1)
summary(a)

## An Example 5.6 from slides 6, summary and plot it
x <- c(2, 10)
ex <- poisgamma(x, 4, 1)
summary(ex)
plot(ex,leg_pos = "right",cex = 1, lty = 5:6,
main = "Distributions of Example5.6")

yijin71/statg012 documentation built on May 23, 2019, 4:04 p.m.