Learn R Programming

RSurveillance (version 0.2.1)

n.hypergeo: Hypergeometric sample size

Description

Calculates sample size for demonstrating freedom or detecting disease using hypergeometric approximation and assuming imperfect test sensitivity, perfect test specificity and representative sampling

Usage

n.hypergeo(sep, N, d, se = 1)

Arguments

sep

desired population sensitivity (scalar or vector)

N

population size (scalar or vector of same length as sep)

d

expected number of infected units in population, = design prevalence*N rounded to next integer (scalar or vector of same length as sep)

se

unit sensitivity, default = 1 (scalar or vector of same length as sep)

Value

vector of sample sizes, NA if n>N

Examples

Run this code
# NOT RUN {
# examples for n.hypergeo - checked
n.hypergeo(0.95, N=100, d=1, se = 0.95)
n.hypergeo(sep=0.95, N=c(100, 200, 500, 1000, 10000), d=ceiling(0.01*c(100, 200, 500, 1000, 10000)))
n.hypergeo(c(0.5, 0.8, 0.9, 0.95), N=100, d=5)
n.hypergeo(0.95, N=80, d=c(1, 2, 5, 10))
n.hypergeo(0.95, N=80, d=c(1, 2, 5, 10), se = 0.8)
# }

Run the code above in your browser using DataLab