nbinombeta: Negative binomial sampling distribution with a beta...

Description Usage Arguments Value Source References See Also Examples

Description

Define the posterior distribution function for π ( θ | k ), with a beta prior distribution π ( θ; α, β ) and a negative binomial sampling distribution p ( k | θ ).

Usage

1
nbinombeta(alpha = 1, beta = 1, k, r, theta = seq(0, 1, 0.001))

Arguments

alpha

the parameter for the beta distribution ( ≥ 0 ).

beta

the parameter for the beta distribution ( ≥ 0 ).

k

the number of failures in rth successes

r

the rth successes.

theta

the range of the probability of success.

Value

An object of class "g12post" is returned.

prior

the prior distribution, i.e. the beta(α,β) distribution.

likelihood

the likelihood function of k given θ, i.e. the nbinomial(r,θ) distribution.

posterior

the posterior distribution of θ given k, i.e. the beta(α+r, β+k) distribution.

theta

the range of the probability of success.

pri.alpha

the alpha parameter for the beta distribution of prior.

pri.beta

the beta parameter for the beta distribution of prior.

pos.alpha

the alpha parameter for the beta distribution of posterior.

pos.beta

the beta parameter for the beta distribution of posterior.

model

the prior and likelihood type to produce the posterior.

Source

For the theory, based on

1
The STATG012 slides2 Example3.6 on Moodle at UCL.

STATG012 slides2

References

Cook, JD. 2009. Notes on the Negative Binomial Distribution. Available from: reference link.

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
## example : 3 failures before the 2th successes and a beta(4,6) prior.
ex <- nbinombeta(4, 6, 3, 2)
## summary and plot the above example
summary(ex)
plot(ex,lty = 2:3, col = c(5,2))

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