binom.optim
Optimal binomial confidence intervals
Uses optimization to minimize the integrated mean squared error between the calculated coverage and the desired confidence level for a given binomial confidence interval.
Usage
binom.optim(n, conf.level = 0.95, method = binom.lrt, k = n%/%2 + 1, p0 = 0, transform = TRUE, plot = FALSE, tol = .Machine$double.eps^0.5, start = NULL, ...)
Arguments
 n
 The number of independent trials in the binomial experiment.
 conf.level
 The level of confidence to be used in the confidence interval.
 method
 The method used to estimate the confidence interval.
 k
 See Details.
 p0
 The minimum probability of success to allow in the optimization. See Details.
 transform
 logical; If
TRUE
the optimizer will do an unconstrained optimization on the signficance probability in the logit space.  plot
 logical; If
TRUE
the results are sent tobinom.plot
.  tol
 The minimum significance level to allow in the optimization. See Details.
 start
 A starting value on the optimal confidence level.
 ...
 Additional arguments to pass to
optim
.
Details
This function minimizes the squared error between the expected coverage probability and the desired confidence level.
$$\alpha_{opt}=\arg\min_{\alpha}\int_{0}^{1}[C(p,n)(1\alpha)^2dp$$
The optimizer will adjust confidence intervals for all x
=
0
to n
depending on the value of k
provided. If
k
is one, only the confidence levels for x
= 0
and
n
are adjusted. If k
= [n/2]
then all confidence
intervals are adjusted. This assumes the confidence intervals are the
same length for x
= x[k]
and x[n  k + 1]
, which is
the case for all methods provided in this package except
binom.cloglog
.
Value

A
 par
 Final confidence levels. The length of this vector is
k
.  value
 The final minimized value from
optim
.  counts
 The number of function and gradient calls from
optim
.  convergence
 Convergence code from
optim
.  message
 Any message returned by the LBFGSB or BFGS optimizer.
 confint
 A
data.frame
returned from a call tomethod
using the optimized confidence levels.
list
with the following elements:See Also
Examples
binom.optim(10, k = 1) ## determine optimal significance for x = 0, 10 only
binom.optim(3, method = binom.wilson) ## determine optimal significance for all x