trace tracker logo

Confidence of population freedom (NPV) for a surveillance system

This calculator can be used to calculate the confidence of freedom (equivalent to negative predictive value) of a surveillance system. Assumptions are that:

  • Specificity of the testing regimen is assumed to be 100% - any positives detected on screening are followed up to confirm or refute the result; and
  • all test results (after follow-up) are negative.

Inputs are:

  • population-level sensitivity of the surveillance system (SSe for a population, SeH for an individual cluster (herd or flock)); and
  • prior confidence of population freedom and
  • the probability of introduction (the probability that prevalence will exceed the design prevalence during the surveillance period).

Output of the calculation is the posterior confidence that the population is free, given the negative surveillance data.

No results

No example available
No references available
				######################################
# Program to calculate probability of population freedom for given population sensitivity and prior
######################################
# uses RSurveillance package9

# check version and load header script
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, Test Sp = 1, Prior = 0.5
    a1<- type.convert(a0[8:10])

# cat(a0)
# cat(a1)
digits<- 4
Se<- a1[1]
prior<- a1[2]
p.intro<- a1[3]


filename<- digest(Sys.time)
graphfile<- paste(fpath, "tmp/", filename, ".png", sep="")
sinkfile<- paste(fpath, "tmp/", filename, ".txt", sep="")
# cat(a1)
results<- array(0, dim = c(6, 1))
rownames(results)<- c("Population sensitivity", "Population specificity", "Prior confidence of freedom", 
                      "Probability of introduction", "Discounted prior", "PFree (Posterior Confidence of Freedom)") 
results[1:4,1]<- c(Se, 1, prior, p.intro)
tmp<- pfree.1(Se, p.intro, prior)
results[5,1]<- tmp[1,3]
results[6,1]<- tmp[1,4]

# cat(test)
results<- formatC(results, digits = digits)

# write to html and file
heading<- "Confidence of Freedom following negative surveillance"
subheadings<- ""
tmp.file<- paste(fpath, "tmp/", filename, sep = "")
output<- html.output(heading, subheadings, inputs, results = list(results), graphs = "", graph.headings = "", show.inputs = F, show.graphs = F, tmp.file, result.txt = "") 
write.html(output, tmp.file)
cat(output)