Learn R Programming

RSurveillance (version 0.2.1)

ap: Apparent prevalence

Description

Estimates apparent prevalence and confidence limits for given sample size and result, assuming representative sampling

Usage

ap(x, n, type = "wilson", conf = 0.95)

Arguments

x

number of positives in sample

n

sample size, note: either x or n can be a vector, but at least one must be scalar

type

method for estimating CI, one of c("normal", "exact", "wilson", "jeffreys", "agresti-coull", "all"), default = "wilson"

conf

level of confidence required, default = 0.95 (scalar)

Value

either 1) if type = "all", a list with 5 elements, each element a matrix with 6 columns, x, n, proportion, lower confidence limit, upper confidence limit, confidence level and CI method; or 2) a matrix of results for the chosen method

Examples

Run this code
# NOT RUN {
# examples for ap function
n<- 200
x<- 25
conf<- 0.95
ap(x, n)
ap(seq(10, 100, 10), 200, type = "agresti")
ap(seq(10, 100, 10), 200, type = "all")
# }

Run the code above in your browser using DataLab