binobp {Bolstad} | R Documentation |
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.
binobp(x, n, a = 1, b = 1, pi = seq(0, 1, by = 0.001), ...)
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 |
likelihood |
the likelihood of |
posterior |
the
posterior density of |
pi |
the values of |
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 |
## 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)