binom.bayes(x, n, conf.level = 0.95, type = c("highest", "central"),
prior.shape1 = 0.5, prior.shape2 = 0.5,
tol = .Machine$double.eps^0.5, maxit = 1000, ...)
p|x ~ Beta(x + prior.shape1, n - x + prior.shape2)
The default prior is Jeffrey's prior which is a Beta(0.5, 0.5)
distribution. Thus the posterior mean is (x + 0.5)/(n + 1)
.
The default type of interval constructed is "highest" which computes
the highest probability density (hpd) interval which assures the
shortest interval possible. The hpd intervals will achieve a
probability that is within tol of the specified conf.level. Setting
type to "central" constructs intervals that have equal tail
probabilities.
If 0 or n successes are observed, a one-sided confidence interval is
returned.
binom.confint
, binom.cloglog
,
binom.logit
, binom.probit
binom.bayes(x = 0:10, n = 10, tol = 1e-9)
Run the code above in your browser using DataCamp Workspace