Pooled prevalence using a Gibbs sampler

Input Values


This method uses a Bayesian approach and a Gibbs sampler iterative model to estimate the posterior distribution of the true animal-level prevalence of infection for a given pool size, number of pools tested, number of pools positive and estimated test sensitivity and specificity. See the User Guide or Cowling et al. (1999) (Method 7) for more details. See demonstration analysis

Input values

Required inputs are pool size, number of pools tested, number positive and alpha and beta parameters for prior Beta distributions for true prevalence and test sensitivity and specificity. For pooled testing, sensitivity and specificity should be estimated at the pool-level, rather than at the individual-level. Additional inputs are the number of iterations to be simulated in the Gibbs sampler, the number of iterations to be discarded to allow convergence of the model and lower and upper probability (confidence) limits for summarising the output distributions. The Gibbs sampler is then used to estimate the probability distributions of true prevalence, sensitivity and specificity that best fit the data and prior distributions provided.

Prior distributions for Prevalence, Se and Sp

The Gibbs sampler requires prior estimates of the true prevalence and test sensitivity and specificity, based on expert knowledge or previous data. These estimates are specified as Beta probability distributions, with parameters alpha and beta. Beta probability distributions are commonly used to express uncertainty about a proportion based on a random sample of individuals. In this situation, if x individuals are positive for a characteristic out of n examined, then the alpha and beta parameters can be calculated as alpha = x + 1 and beta = n - x + 1. Alternatively, alpha and beta can be calculated using the Beta distribution utilities, provided estimates of the mode and 5% or 95% confidence limits are available from expert opinion.

If there is no prior information on which to base a prior distribution, alpha = beta = 1 should be used. This results in a uniform (uninformed) distribution, in which all values between 0 and 1 have equal probability of occurrence.


Outputs for this method are posterior probability distributions for prevalence, sensitivity and specificity. These distributions are described by their minimum, maximum, upper and lower probability limits specified, median, mean and standard deviation. A histogram and density chart and a text file of simulation results can also be downloaded for each parameter.

How many iterations?

Because the Gibbs sampler estimates prevalence iteratively, based on the data and the prior distributions, it may take a number of iterations for the model to converge on the true value. It is also important to carry out an adequate numebr of iterations to support inference from the results. suggested default values for the total number of iterations and the number to be discarded are provided, but can be varied if desired.

Please note:

This analysis may take several minutes to complete, depending on the number of iterations required.

Test results:
Size of pools:
Number of pools tested:
Number of positive pools:
Alpha & Beta parameters for prior distributions:
Alpha Beta
Prior prevalence:
Test Sensitivity:
Test Specificity:
Simulation details:
Number of iterations:
Number to discard:
Lower CL for output:
Upper CL for output:


This module takes several minutes to run, depending on numbers of iterations requested, and may time-out. Enter your email address (optionally) and an email will be sent to you with a link to the results.

  Home  |   About this site  |   Glossary   |   References   |   Links  

This site was created by Ausvet with funding from a range of sources.
It provides a range of epidemiological tools for the use of researchers and epidemiologists, particularly in animal health.
Please send any comments, questions or suggestions to Evan Sergeant
© 2019 Ausvet