Learn R Programming

RSurveillance (version 0.2.1)

n.tp: Sample size for true prevalence

Description

Calculates sample size for estimating true prevalence using normal approximation

Usage

n.tp(p, se, sp, precision, conf = 0.95)

Arguments

p

estimated true prevalence (scalar or vector)

se

test sensitivity (scalar or vector)

sp

test specificity (scalar or vector)

precision

absolute precision, +/- proportion equal to half the width of the desired confidence interval (scalar or vector)

conf

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

Value

a vector of sample sizes

Examples

Run this code
# NOT RUN {
# examples for n.tp
n.tp(0.1, 0.9, 0.99, 0.05)
n.tp(0.1, 0.9, 0.99, 0.05, conf = 0.99)
n.tp(c(0.05, 0.1, 0.2, 0.3, 0.4, 0.5), 0.9, 0.99, 0.05)
n.tp(0.5, 0.9, 0.99, c(0.01, 0.02, 0.05, 0.1, 0.2))
# }

Run the code above in your browser using DataLab