# Design prevalence required to achieve target population (cluster or system) sensitivity

Calculate the design prevalence required to achieve a desired cluster or system (population) level sensitivity.

Inputs are the test or cluster sensitivity for the sampling, sample size tested, population size (optional) and the required herd or system sensitivity. Enter test sensitivity if the target is a cluster level sensitivity or cluster-sensitivity if the target is a system or population level sensitivity. If population size is entered the hypergeometric approximation is used, otherwise the calculation is based on the binomial distribution.

The main output is the design prevalence required to achieve the specified target cluster or system sensitivity. This design prevalence is an animal (unit) level prevalence for a target cluster sensitivity, or a cluster level prevalence for a target system (population) level sensitivity.

If the size of the population is provided, an additional output is the expected maximum number of infected units in the population, for the given confidence level (population sensitivity) and assuming that all samples tested are negative.

No results

###################################### # Program to calculate design pprevalence to give desired level of SSe/SeH ###################################### # uses RSurveillance package rm(list = ls()) test<- ifelse(length(commandArgs()) < 3, TRUE, FALSE) fpath<- ifelse(test, "webRootUrl", "rtoolsPath") # load header scripts source(paste(fpath, "R/epi_head.R", sep = "")) source(paste(fpath, "R/HTMLStream.R", sep = "")) source(paste(fpath, "R/epitools_functions.r", sep = "")) # extract command arguments # test Se, n, N, desired SeH a1<- type.convert(a0[8:11]) # cat(a0) # cat(a1) digits<- 4 Sens<- a1[1] n<- a1[2] N<- a1[3] target.seh<- a1[4] filename<- digest(Sys.time) graphfile<- "" sinkfile<- paste(fpath, "tmp/", filename, ".txt", sep="") sink(sinkfile) # table of inputs inputs<- array("", dim = c(length(a1), 1)) inputs[1:length(a1), 1]<- a1[1:length(a1)] rownames(inputs)<- c("Test (or cluster) sensitivity", "Sample size", "Population size", "Desired population sensitivity") if (N == -1) { inputs[3, 1]<- "Unknown" Pstar<- pstar.calc(N=NA, n, target.seh, Sens) inputs<- rbind(inputs, "Design prevalence to achieve target population sensitivity" = round(Pstar, digits)) } else { Pstar<- pstar.calc(N, n, target.seh, Sens) inputs<- rbind(inputs, "Design prevalence to achieve target population sensitivity" = round(Pstar, digits)) inputs<- rbind(inputs, "Maximum number of infected units in the population" = floor(Pstar*N)) } sink() # write to html and file heading<- "Design prevalence required to achieve target population (cluster or system) sensitivity" subheadings<- "" graph.txt<- "" tmp.file<- paste(fpath, "tmp/", filename, sep = "") result.txt<- "" output<- html.output(heading, subheadings, inputs, results = list(inputs), graphs = "", graph.headings = graph.txt, show.inputs = F, show.graphs = F, tmp.file, result.txt = result.txt) write.html(output, tmp.file) cat(output)