binom.jeffreys: Jeffreys confidence limits

Description Usage Arguments Value Examples

View source: R/prevalence_functions.R

Description

Calculates Jeffreys confidence limits for a simple proportion (apparent prevalence)

Usage

1
binom.jeffreys(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.jeffreys
binom.jeffreys(25, 200)
binom.jeffreys(seq(10, 100, 10), 200)
binom.jeffreys(50, seq(100, 1000, 100))

Example output

   x   n proportion      lower    upper conf.level   method
1 25 200      0.125 0.08462743 0.176126       0.95 jeffreys
     x   n proportion      lower      upper conf.level   method
1   10 200       0.05 0.02599340 0.08687509       0.95 jeffreys
2   20 200       0.10 0.06416642 0.14729862       0.95 jeffreys
3   30 200       0.15 0.10567714 0.20436243       0.95 jeffreys
4   40 200       0.20 0.14910087 0.25950769       0.95 jeffreys
5   50 200       0.25 0.19387268 0.31330266       0.95 jeffreys
6   60 200       0.30 0.23970343 0.36603761       0.95 jeffreys
7   70 200       0.35 0.28642624 0.41787992       0.95 jeffreys
8   80 200       0.40 0.33393964 0.46893129       0.95 jeffreys
9   90 200       0.45 0.38218245 0.51925306       0.95 jeffreys
10 100 200       0.50 0.43112169 0.56887831       0.95 jeffreys
    x    n proportion      lower      upper conf.level   method
1  50  100 0.50000000 0.40317395 0.59682605       0.95 jeffreys
2  50  200 0.25000000 0.19387268 0.31330266       0.95 jeffreys
3  50  300 0.16666667 0.12778866 0.21193873       0.95 jeffreys
4  50  400 0.12500000 0.09532127 0.16008042       0.95 jeffreys
5  50  500 0.10000000 0.07601365 0.12859922       0.95 jeffreys
6  50  600 0.08333333 0.06321161 0.10746127       0.95 jeffreys
7  50  700 0.07142857 0.05410074 0.09228966       0.95 jeffreys
8  50  800 0.06250000 0.04728563 0.08087121       0.95 jeffreys
9  50  900 0.05555556 0.04199557 0.07196675       0.95 jeffreys
10 50 1000 0.05000000 0.03777013 0.06482846       0.95 jeffreys

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