Description Usage Arguments Value Source References See Also Examples
Define the posterior distribution function for π ( θ | r ), with a beta prior distribution π ( θ; α, β ) and a binomial sampling distribution p ( r | θ ).
1 |
alpha |
the parameter for the beta distribution ( ≥ 0 ). |
beta |
the parameter for the beta distribution ( ≥ 0 ). |
n |
the number of trials in binomial distribution. |
r |
the number of successes in n trials. |
theta |
the range of the probability of success. |
An object of class "g12post
" is returned.
prior |
the prior distribution, i.e. the beta(α,β) distribution. |
likelihood |
the likelihood function of r given θ, i.e. the binomial(n,r) distribution. |
posterior |
the posterior distribution of θ given r, i.e. the beta(α+r, β+n-r) 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. |
For code binombeta
, based on
1 2 | Curren,J.(2017) R topics documentated:bingcp-Package
'Bolstad'. Pp15.
|
For the theory, based on
1 | The STATG012 slides2 Example3.6 on Moodle at UCL.
|
Bolstad, W.M. 2007. Introduction to Bayesian Statistics. (2nd ed.). Hoboken, New Jersey: John Wiley & Sons, Inc.
summary.g12post
for summararies of prior
and posterior distribution.
plot.g12post
for plots of prior and posterior
distribution.
1 2 3 4 5 6 7 8 9 | ## simplest one with 3 successes in 10 trials and a constant
## (uniform beta(1,1)) prior, then the posterior distribution
## has exactly the same shape as the likelihood function.
a <- binombeta(n = 6, r = 2)
summary(a)
## example 3.6 : 3 successes in 10 trials and a beta(4,6) prior.
ex <- binombeta(4, 6, 10, 3)
plot(ex, lty = 1:2, col = c(4,2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.