n.freedom: Freedom sample size

Description Usage Arguments Value Examples

View source: R/freedom_functions_1.R

Description

Calculates sample size for demonstrating freedom or detecting disease using the appropriate method, depending on whether or not N provided (hypergeometric if N provided, binomial otherwise), assuming imperfect test sensitivity, perfect test specificity and representative sampling

Usage

1
n.freedom(N = NA, sep = 0.95, pstar, se = 1)

Arguments

N

population size, default = NA (unknown) (scalar or vector of same length as sep)

sep

desired population sensitivity (scalar or vector)

pstar

specified design prevalence as proportion or integer (scalar or vector of same length as sep)

se

unit sensitivity (scalar or vector of same length as sep)

Value

vector of sample sizes, NA if N is specified and n>N

Examples

1
2
3
4
5
# examples for n.freedom - checked
n.freedom(NA, sep=0.95, pstar=0.01, se=1)
n.freedom(500, sep=0.95, pstar=0.01, se=1)
n.freedom(N=c(100, 500, 1000, 5000, 10000, 100000, NA), sep=0.95, pstar=0.01, se=1)
n.freedom(500, sep=0.95, pstar=0.01, se=c(0.5, 0.6, 0.7, 0.8, 0.9, 0.99, 1))

Example output

[1] 299
[1] 226
[1]  95 226 259 291 296 300 299
[1] 451 376 322 282 251 228 226

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