tp: True prevalence

Description Usage Arguments Value Examples

View source: R/prevalence_functions.R

Description

Estimates true prevalence and confidence limits for given sample size and result, according to specified method

Usage

1
tp(x, n, se, sp, type = "blaker", conf = 0.95)

Arguments

x

number of positive units (scalar)

n

sample size (no. units sampled) (scalar)

se

test sensitivity (scalar)

sp

test specificity (scalar)

type

method for estimating CI, one of c("normal", "c-p", "sterne", "blaker", "wilson", "all")

conf

desired level of confidence for CI, default = 0.95 (scalar)

Value

list with 2 elements, a matrix of apparent prevalence and lower and upper confidence limits and a matrix of true prevalence and lower and upper confidence limits using the chosen method(s)

Examples

1
2
3
4
5
6
7
8
9
# examples for tp
x<- 20
n<- 120
se<- 0.9
sp<- 0.99
conf<- 0.95
tp(x, n, se, sp, "all")
tp(x, n, se, sp, "c-p")
tp(x, n, 0.95, 0.9, "c-p")

Example output

$ap
             est     lower     upper
normal 0.1666667 0.1105600 0.2434528
blaker 0.1666667 0.1051785 0.2440000
c-p    0.1666667 0.1048785 0.2456000
wilson 0.1666667 0.1105600 0.2434528
sterne 0.1666667 0.1069042 0.2450786

$tp
           est     lower     upper
normal 0.17603 0.1011094 0.2509506
blaker 0.17603 0.1069421 0.2629214
c-p    0.17603 0.1066051 0.2647191
wilson 0.17603 0.1129887 0.2623065
sterne 0.17603 0.1088811 0.2641333

$ap
        est     lower  upper
1 0.1666667 0.1048785 0.2456

$tp
      est     lower     upper
1 0.17603 0.1066051 0.2647191

$ap
        est     lower  upper
1 0.1666667 0.1048785 0.2456

$tp
         est       lower     upper
1 0.07843137 0.005739414 0.1712942

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