Pooled Prevalence
# Pooled prevalence using a Gibbs sampler

### Input values

### Prior distributions for Prevalence, Se and Sp

### Outputs

### How many iterations?

### Please note

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.

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.

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.

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.

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