Learn R Programming

RSurveillance (version 0.2.1)

n.freedom: Freedom sample size

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

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

Run this code
# NOT RUN {
# 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))
# }

Run the code above in your browser using DataLab