# NOT RUN {
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
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab