binom.confint: Binomial confidence intervals

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/binom.confint.R

Description

Uses eight different methods to obtain a confidence interval on the binomial probability.

Usage

1
binom.confint(x, n, conf.level = 0.95, methods = "all", ...)

Arguments

x

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.

methods

Which method to use to construct the interval. Any combination of c("exact", "ac", "asymptotic", "wilson", "prop.test", "bayes", "logit", "cloglog", "probit") is allowed. Default is "all".

...

Additional arguments to be passed to binom.bayes.

Details

Nine methods are allowed for constructing the confidence interval(s):

By default all eight are estimated for each value of x and/or n. For the "logit", "cloglog", "probit", and "profile" methods, the cases where x == 0 or x == n are treated separately. Specifically, the lower bound is replaced by (alpha/2)^n and the upper bound is replaced by (1-alpha/2)^n.

Value

A data.frame containing the observed proportions and the lower and upper bounds of the confidence interval for all the methods in "methods".

Author(s)

Sundar Dorai-Raj (sdorairaj@gmail.com)

References

A. Agresti and B.A. Coull (1998), Approximate is better than "exact" for interval estimation of binomial proportions, American Statistician, 52:119-126.

R.G. Newcombe, Logit confidence intervals and the inverse sinh transformation (2001), American Statistician, 55:200-202.

L.D. Brown, T.T. Cai and A. DasGupta (2001), Interval estimation for a binomial proportion (with discussion), Statistical Science, 16:101-133.

Gelman, A., Carlin, J. B., Stern, H. S., and Rubin, D. B. (1997) Bayesian Data Analysis, London, U.K.: Chapman and Hall.

See Also

binom.bayes, binom.logit, binom.probit, binom.cloglog, binom.coverage, prop.test, binom.test for comparison to method "exact"

Examples

1
binom.confint(x = c(2, 4), n = 100, tol = 1e-8)

Example output

          method x   n       mean        lower      upper
1  agresti-coull 2 100 0.02000000  0.001095977 0.07441778
2  agresti-coull 4 100 0.04000000  0.012418859 0.10161516
3     asymptotic 2 100 0.02000000 -0.007439496 0.04743950
4     asymptotic 4 100 0.04000000  0.001592707 0.07840729
5          bayes 2 100 0.02475248  0.001548220 0.05487873
6          bayes 4 100 0.04455446  0.009880014 0.08495779
7        cloglog 2 100 0.02000000  0.003866705 0.06362130
8        cloglog 4 100 0.04000000  0.013067378 0.09175206
9          exact 2 100 0.02000000  0.002431337 0.07038393
10         exact 4 100 0.04000000  0.011004494 0.09925716
11         logit 2 100 0.02000000  0.005007519 0.07643178
12         logit 4 100 0.04000000  0.015094076 0.10175601
13        probit 2 100 0.02000000  0.004390455 0.06850351
14        probit 4 100 0.04000000  0.014032309 0.09594809
15       profile 2 100 0.02000000  0.003356435 0.06047940
16       profile 4 100 0.04000000  0.012621438 0.09048300
17           lrt 2 100 0.02000000  0.003353612 0.06047875
18           lrt 4 100 0.04000000  0.012592624 0.09048265
19     prop.test 2 100 0.02000000  0.003471713 0.07736399
20     prop.test 4 100 0.04000000  0.012890866 0.10511152
21        wilson 2 100 0.02000000  0.005501968 0.07001179
22        wilson 4 100 0.04000000  0.015663304 0.09837071

binom documentation built on May 2, 2019, 5:16 p.m.

Related to binom.confint in binom...