Vector of number of successes in the binomial experiment.
n
Vector of number of independent trials in the binomial experiment.
conf.level
The level of confidence to be used in the confidence
interval.
bayes
logical; if TRUE use a Bayesian correction at the
edges. Specfically, a beta prior with shape parameters 0.5 is used.
If bayes is numeric, it is assumed to be the parameters
to beta distribution.
conf.adj
logical; if TRUE 0 or 100% successes return a
one-sided confidence interval
plot
logical; if TRUE a plot showing the the square root
of the binomial deviance with reference lines for mean, lower, and
upper bounds. This argument can also be a list of plotting parameters
to be passed to xyplot.
...
ignored
Details
Confidence intervals are based on profiling the binomial deviance in the
neighbourhood of the MLE. If x == 0 or x == n and
bayes is TRUE, then a Bayesian adjustment is made to move
the log-likelihood function away from Inf. Specifically, these
values are replaced by (x + 0.5)/(n + 1), which is the posterier
mode of f(p|x) using Jeffrey's prior on p. Furthermore, if
conf.adj is TRUE, then the upper (or lower) bound uses
a 1 - alpha confidence level. Typically, the
observed mean will not be inside the estimated confidence interval.
If bayes is FALSE, then the Clopper-Pearson exact method
is used on the endpoints. This tends to make confidence intervals at the
end too conservative, though the observed mean is guaranteed to be
within the estimated confidence limits.
Value
A data.frame containing the observed
proportions and the lower and upper bounds of the confidence
interval.