n.ap: Sample size for apparent prevalence

Description Usage Arguments Value Examples

View source: R/prevalence_functions.R

Description

Calculates sample size for estimating apparent prevalence (simple proportion)

Usage

1
n.ap(p, precision, conf = 0.95)

Arguments

p

expected proportion, scalar or vector of values

precision

absolute precision, +/- proportion equivalent to half the width of the desired confidence interval, scalar or vector of values, note: at least one of p and precision must be a scalar

conf

level of confidence required, default = 0.95 (scalar)

Value

a vector of sample sizes

Examples

1
2
3
4
5
# examples of n.ap
n.ap(0.5, 0.1)
n.ap(0.5, 0.1, conf=0.99)
n.ap(seq(0.1, 0.5, by = 0.1), 0.05)
n.ap(0.2, c(0.01, 0.02, 0.05, 0.1))

Example output

[1] 97
[1] 166
[1] 139 246 323 369 385
[1] 6147 1537  246   62

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