binom.conf.int: Confidence intervals for binomial counts or proportions

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

Description

Calculates confidence intervals for binomial counts or proportions

Usage

1
2
3
binom.exact(x, n, conf.level = 0.95)
binom.wilson(x, n, conf.level = 0.95)
binom.approx(x, n, conf.level = 0.95)

Arguments

x

number of successes in n trials, can be a vector

n

number of Bernoulli trials, can be a vector

conf.level

confidence level (default = 0.95), can be a vector

Details

The function, binom.exact, calculates exact confidence intervals for binomial counts or proportions. This function uses R's binom.test function; however, the arguments to this function can be numeric vectors of any length.

The function, binom.wilson, calculates confidence intervals for binomial counts or proportions using Wilson's formula which approximate the exact method. The arguments to this function can be numeric vectors of any length (Rothman).

The function, binom.approx, calculates confidence intervals for binomial counts or proportions using a normal approximation to the binomial distribution. The arguments to this function can be numeric vectors of any length.

Value

This function returns a n x 6 matrix with the following colnames:

x

number of successes in n trials

n

number of Bernoulli trials

prop

proportion = x/n

lower

lower confidence interval limit

upper

upper confidence interval limit

conf.level

confidence level

Author(s)

Tomas Aragon, aragon@berkeley.edu, http://www.phdata.science

References

Tomas Aragon, et al. Applied Epidemiology Using R. Available at http://www.phdata.science

Kenneth Rothman (2002), Epidemiology: An Introduction, Oxford University Press, 1st Edition.

See Also

pois.exact, binom.test

Examples

1
2
3
binom.exact(1:10, seq(10, 100, 10))
binom.wilson(1:10, seq(10, 100, 10))
binom.approx(1:10, seq(10, 100, 10))

Example output

    x   n proportion       lower     upper conf.level
1   1  10        0.1 0.002528579 0.4450161       0.95
2   2  20        0.1 0.012348527 0.3169827       0.95
3   3  30        0.1 0.021117137 0.2652885       0.95
4   4  40        0.1 0.027925415 0.2366374       0.95
5   5  50        0.1 0.033275094 0.2181354       0.95
6   6  60        0.1 0.037591269 0.2050577       0.95
7   7  70        0.1 0.041159702 0.1952457       0.95
8   8  80        0.1 0.044170940 0.1875651       0.95
9   9  90        0.1 0.046755315 0.1813600       0.95
10 10 100        0.1 0.049004689 0.1762226       0.95
    x   n proportion      lower     upper conf.level
1   1  10        0.1 0.01787621 0.4041500       0.95
2   2  20        0.1 0.02786648 0.3010336       0.95
3   3  30        0.1 0.03459989 0.2562108       0.95
4   4  40        0.1 0.03957953 0.2305178       0.95
5   5  50        0.1 0.04347576 0.2136023       0.95
6   6  60        0.1 0.04664283 0.2014946       0.95
7   7  70        0.1 0.04928930 0.1923291       0.95
8   8  80        0.1 0.05154762 0.1851069       0.95
9   9  90        0.1 0.05350675 0.1792417       0.95
10 10 100        0.1 0.05522914 0.1743657       0.95
    x   n proportion        lower     upper conf.level
1   1  10        0.1 -0.085938510 0.2859385       0.95
2   2  20        0.1 -0.031478381 0.2314784       0.95
3   3  30        0.1 -0.007351649 0.2073516       0.95
4   4  40        0.1  0.007030745 0.1929693       0.95
5   5  50        0.1  0.016845771 0.1831542       0.95
6   6  60        0.1  0.024090921 0.1759091       0.95
7   7  70        0.1  0.029721849 0.1702782       0.95
8   8  80        0.1  0.034260809 0.1657392       0.95
9   9  90        0.1  0.038020497 0.1619795       0.95
10 10 100        0.1  0.041201080 0.1587989       0.95

epitools documentation built on March 26, 2020, 9:14 p.m.