binom.blaker.limits {BlakerCI} | R Documentation |
Blaker's binomial confidence limits
Description
Fast and accurate calculation of Blaker's binomial confidence limits.
Usage
binom.blaker.limits(x, n, level = 0.95, tol = 1e-10, ...)
Arguments
x |
number of successes. |
n |
number of trials. |
level |
confidence level. |
tol |
numerical tolerance. |
... |
additional arguments to be passed to |
Details
Note that the Blaker's (1 - alpha)
confidence interval
is the convex hull of the set C
of those points
where the acceptability function (Blaker (2000)) exceeds
level alpha
. The original numerical algorithm from
Blaker (2000) is prone, when C
is a union
of disjoint intervals, to skipping a short interval
and finding inaccurate over-liberal confidence limits.
Function binom.blaker.limits
is, by contrast,
immune from such failures and yields always as
its result the whole confidence interval (Klaschka (2010)).
Value
Length 2 vector – the lower and upper confidence limits.
Note
Package exactci
by M. P. Fay includes another algorithm
that calculates Blaker's binomial confidence limits
(see user-level function binom.exact
and internal function
exactbinomCI
).
It is more sophisticated than the original Blaker's one,
but considerably slower and sometimes less accurate
than that of binom.blaker.limits
.
Earlier 2010 versions of the algorithm of binom.blaker.limits
were designed independently of (though already existing)
M.P. Fay's packages exact2x2
and exactci
.
Some later modifications, however, have been inspired
by Fay's programs.
Lecoutre & Poitevineau (2014) designed another algorithm
for the calculation of the Blaker's confidence limits.
Despite more abstract theoretical background and broader
scope (not confined to the binomial distribution),
it is closely analogous to that of binom.blaker.limits
.
Author(s)
Jan Klaschka klaschka@cs.cas.cz
References
Blaker, H. (2000) Confidence curves and improved exact confidence
intervals for discrete distributions.
Canadian Journal of Statistics 28: 783-798.
(Corrigenda: Canadian Journal of Statistics 29: 681.)
Klaschka, J. (2010). BlakerCI: An algorithm and R package for the Blaker's binomial confidence limits calculation. Technical report No. 1099, Institute of Computer Science, Academy of Sciences of the Czech Republic, http://hdl.handle.net/11104/0195722.
Lecoutre, B. & Poitevineau J. (2014). New results for computing Blaker's exact confidence interval limits for usual one-parameter discrete distributions. Communications in Statistics - Simulation and Computation, http://dx.doi.org/10.1080/03610918.2014.911900.
See Also
exactci:binom.exact | One of the options yields Blaker's limits. The algorithm is more sophisti- |
cated than the original Blaker's one. | |
propCIs:blakerci | Implementation of the original algorithm from Blaker (2000). |
binGroup:binBlaker | Another implementation of the same algorithm. |
Examples
binom.blaker.limits(3,10) # [1] 0.08726443 0.61941066
## Example of a failure of the original algorithm:
## Requires PropCIs package.
## Tolerance 1e-4 - default in the Blaker's paper.
## Not run:
blakerci(29,99,conf.level=0.95,tolerance=1e-4) ## [1] 0.2096386 0.3923087
## The correct upper limit should be 0.3929\dots,
## as demonstrated:
## (1) By the same function with a smaller tolerance:
blakerci(29,99,conf.level=0.95,tolerance=1e-7) ## [1] 0.2097022 0.3929079
## (2) By binom.blaker.limits
## (default confidence limit 0.95, default tolerance 1e-10):
binom.blaker.limits(29,99) ## [1] 0.2097022 0.3929079
## (3) By exactbinomCI function from package exactci
## (default confidence level, default tolerance):
exactbinomCI(29,99,tsmethod="blaker")[1:2] ## [1] 0.2097 0.3929
## The same function, smaller tolerance:
exactbinomCI(29,99,tsmethod="blaker",tol=1e-8)[1:2]
## [1] 0.2097022 0.3929079
## Another example of a failure of the original algorithm
## with even as small tolerance as 1e-6:
blakerci(59,355,conf.level=0.95,tolerance=1e-4) ## [1] 0.1299899 0.2085809
blakerci(59,355,conf.level=0.95,tolerance=1e-5) ## [1] 0.1300799 0.2085409
blakerci(59,355,conf.level=0.95,tolerance=1e-6) ## [1] 0.1300799 0.2085349
## Only for tolerance = 1e-7 the result is satisfactory
## and in agreement with binom.blaker.limits:
blakerci(59,355,conf.level=0.95,tolerance=1e-7) ## [1] 0.1300807 0.2090809
binom.blaker.limits(59,355) ## [1] 0.1300807 0.2090809
## End(Not run)