The prevalence package
ThetruePrev() : Estimate true prevalence from individuals samplestruePrevPools() : Estimate true prevalence from pooled samples
The Bayesian method for estimating true prevalence from individual samples is also available as an online R/Shiny application
Download and installation
Version 0.1.0 of theTo install the
 download and install the latest version of R via cran.rproject.org
 download and install JAGS via mcmcjags.sourceforge.net
 download and install package
coda :install.packages("coda")  download and install package
rjags :install.packages("rjags")  download and install package
prevalence :install.packages("prevalence")
Individual samples: function truePrev()
Implementation
truePrev(x, n, SE = 1, SP = 1, prior = c(1, 1), conf.level = 0.95,
nchains = 2, burnin = 5000, update = 10000,
verbose = FALSE, plot = FALSE)
Different distributions are available to specify test sensitivity
Fixed:  
This is the default distribution used when a single numeric value is specified for 

Uniform:  
Beta:  
BetaPERT:  
Type 

BetaExpert:  
Only Type 
Examples
SE < list(dist = "uniform", min = 0.60, max = 1.00)
SP < list(dist = "uniform", min = 0.75, max = 1.00)
truePrev(x = 142, n = 742, SE = SE, SP = SP)
SE < list(dist = "pert", a = 0.60, m = 0.90, b = 1.00)
SP < list(dist = "betaexpert", mode = 0.90, lower = 0.75, p = 0.95)
truePrev(x = 142, n = 742, SE = SE, SP = SP)
truePrev(x = 142, n = 742, SE = 0.90, SP = 0.90)
More information
For more information on this function, typeAn introduction to Frequentist and Bayesian methods for assessing true prevalence from individual samples has been published as a Hints & Kinks paper in International Journal of Public Health:
Misclassification errors in prevalence estimation: Bayesian handling with care.
Speybroeck N, Devleesschauwer B, Joseph L, Berkvens D
Pooled samples: function truePrevPools()
Implementation
truePrevPools(x, n, SE = 1, SP = 1, prior = c(1, 1), conf.level = 0.95,
nchains = 2, burnin = 5000, update = 10000,
verbose = FALSE, plot = FALSE)
Different distributions are available to specify test sensitivity
Note that
Example
pool_results < c(0, 0, 0, 0, 0, 0, 0, 0, 1, 0)
pool_sizes < c(2, 1, 6, 10, 1, 7, 1, 4, 1, 3)
SE < list(dist = "uniform", min = 0.60, max = 0.95)
truePrevPools(x = pool_results, n = pool_sizes, SE = SE, SP = 1)
More information
For more information on this function, typeAn overview of Frequentist and Bayesian methods for estimating population prevalence based on pooled samples has been published in Medical and Veterinary Entomology:
Estimating the prevalence of infections in vector populations using pools of samples
Speybroeck N, Williams CJ, Lafia KB, Devleesschauwer B, Berkvens D
This paper provides the following R code:
 Exact Bayesian Computation method (True prevalence)
 Maximum Likelihood Estimation (Apparent prevalence)