binom.agresti: Agresti-Coull confidence limits

Description Usage Arguments Value Examples

View source: R/prevalence_functions.R

Description

Calculates Agresti-Coull confidence limits for a simple proportion (apparent prevalence)

Usage

1
binom.agresti(x, n, conf = 0.95)

Arguments

x

number of positives in sample

n

sample size, note: either x or n can be a vector, but at least one must be scalar

conf

level of confidence required, default 0.95 (scalar)

Value

a dataframe with 6 columns, x, n, proportion, lower confidence limit, upper confidence limit, confidence level and CI method

Examples

1
2
3
4
# test binom.agresti
binom.agresti(25, 200)
binom.agresti(seq(10, 100, 10), 200)
binom.agresti(50, seq(100, 1000, 100))

Example output

   x   n proportion      lower     upper conf.level        method
1 25 200      0.125 0.08558957 0.1785444       0.95 agresti-coull
     x   n proportion      lower      upper conf.level        method
1   10 200       0.05 0.02626810 0.09069269       0.95 agresti-coull
2   20 200       0.10 0.06500984 0.15006642       0.95 agresti-coull
3   30 200       0.15 0.10670629 0.20648544       0.95 agresti-coull
4   40 200       0.20 0.15016868 0.26113852       0.95 agresti-coull
5   50 200       0.25 0.19489935 0.31452332       0.95 agresti-coull
6   60 200       0.30 0.24063696 0.36690117       0.95 agresti-coull
7   70 200       0.35 0.28722845 0.41842514       0.95 agresti-coull
8   80 200       0.40 0.33457989 0.46918917       0.95 agresti-coull
9   90 200       0.45 0.38263431 0.51925023       0.95 agresti-coull
10 100 200       0.50 0.43136086 0.56863914       0.95 agresti-coull
    x    n proportion      lower      upper conf.level        method
1  50  100 0.50000000 0.40383153 0.59616847       0.95 agresti-coull
2  50  200 0.25000000 0.19489935 0.31452332       0.95 agresti-coull
3  50  300 0.16666667 0.12855765 0.21320433       0.95 agresti-coull
4  50  400 0.12500000 0.09592152 0.16121270       0.95 agresti-coull
5  50  500 0.10000000 0.07650314 0.12959633       0.95 agresti-coull
6  50  600 0.08333333 0.06362401 0.10834408       0.95 agresti-coull
7  50  700 0.07142857 0.05445670 0.09307860       0.95 agresti-coull
8  50  800 0.06250000 0.04759859 0.08158293       0.95 agresti-coull
9  50  900 0.05555556 0.04227472 0.07261430       0.95 agresti-coull
10 50 1000 0.05000000 0.03802202 0.06542206       0.95 agresti-coull

RSurveillance documentation built on July 2, 2020, 2:33 a.m.