Calculate sample sizes for 2-stage freedom survey where individual herd details are NOT available

Input Values


Calculate least-cost sample sizes for 2-stage surveys for demonstrating disease freedom, where herd sizes are unknown. This analysis calculates the number of herds and the number of animals within each herd to be tested to provide a specified system sensitivity (probability of detecting disease) for the given animal and herd-level design prevalences and test sensitivity, where actual herd sizes are unknown. Test specificity is assumed to be 100% (or follow-up testing of any positive will be undertaken to confirm or exclude disease).

Sample sizes are optimised to minimise overall cost for given herd and animal-level testing costs. A maximum sample size per herd must be specified and either the number of herds in the population or a maximum number of herd to be tested must be specified.

Numbers of animals to test in each herd are calculated using assumed binomial sampling (sample size is small relative to herd sizes), while numbers of herds to test are calculated using the HerdPlus algorithm, based on the hypergeometric probability distribution (sampling without replacement) if the number of herds in the population is specified or assuming binomial sampling if not.

Design prevalence (specified level of disease to be detected) must be specified at both animal and herd levels. Design prevalence can be specified as either:

  • a proportion of the population infected; or
  • a specific (integer) number of herds infected (for herd-prevalence only and only if the number of herds in the population is specified).


Inputs required include:

  • animal-level design prevalence (as a proportion only);
  • herd-level design prevalence and whether this is specified as a proportion or number of herds;
  • the estimated test sensitivity;
  • the relative cost of testing at both herd and animal levels;
  • the target system sensitivity (SSe) which is the probability of detecting disease if it is present at the specified design prevalences;
  • the maximum sample size to be tested per herd; and
  • The number of herds in the population OR the maximum number of herds to be tested.


Outputs from the analysis include:

  • A summary of the total numbers of herds and animals to be sampled, target number of animals to test per herd, estimated SeH per herd and the achieved SSe;
  • A summary of numbers of herds to be tested and corresponding numbers of animals to test in each herd, the estimated SeH and the relative cost for each option; and
  • An excel spreadsheet and graph of the summary results.

If it is not possible to achieve the desired system sensitivity by testing the specified maximum number of animals in all (or the specified maximum number) of the herds, a message will be returned, along with a summary of the achieved mean SeH and SSe if the maximum numbers of animals and herds were tested.

Animal-level design prevalence:
Herd-level design prevalence:
Test sensitivity:
Relative testing cost per herd:
Relative testing cost per animal:
Target System Sensitivity (confidence):
Maximum sample size per herd:
Number of herds in the population (optional):
Maximum number of herds to test:


  Home  |   About this site  |   Glossary   |   References   |   Links   |  128 recent calculations

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
© 2017 Ausvet