Description Usage Arguments Value See Also Examples
Evaluates and plots the posterior density for pi, the probability of a success in a Bernoulli trial, with binomial sampling and a continous beta(a,b) prior.
1 |
x |
the number of observed successes in the binomial experiment. |
n |
the number of trials in the binomial experiment. |
a |
parameter for the beta prior - must be greater than zero |
b |
parameter for the beta prior - must be greater than zero |
pi |
A range of values for the prior to be calculated over. |
... |
additional arguments that are passed to |
An object of class 'Bolstad' is returned. This is a list with the following components:
prior |
the prior density of pi, i.e. the beta(a,b) density |
likelihood |
the likelihood of x given pi and n, i.e. the binomial(n,pi) density |
posterior |
the posterior density of pi given x and n - i.e. the beta(a+x,b+n-x) density |
pi |
the values of pi for which the posterior density was evaluated |
mean |
the posterior mean |
var |
the posterior variance |
sd |
the posterior std. deviation |
quantiles |
a set of quantiles from the posterior |
cdf |
a cumulative distribution function for the posterior |
quantileFun |
a quantile function for the posterior |
1 2 3 4 5 6 7 8 9 10 11 | ## simplest call with 6 successes observed in 8 trials and a beta(1,1) uniform
## prior
binobp(6,8)
## 6 successes observed in 8 trials and a non-uniform beta(0.5,6) prior
binobp(6,8,0.5,6)
## 4 successes observed in 12 trials with a non uniform beta(3,3) prior
## plot the stored prior, likelihood and posterior
results = binobp(4, 12, 3, 3)
decomp(results)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.