# Calculate sample sizes for 2-stage freedom survey with fixed herd/flock sensitivity

## Input Values

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

Numbers of herds to test are calculated using the hypergeometric apprximation if the number of herds in the population is specified as well as using the binomial fomula assuming unknown (large) number of herds in the population. If the population size is not specified only the binomial results are presented.

Numbers of animals to test in each herd are calculated for a range of herd sizes using the hypergeometric approximation and for unknown (large) herd sizes using the binomial calculation.

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

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 target herd or flock sensitivity (SeH) which is the probability of detecting disease if it is present in a herd at the specified animal-level design prevalence;
• the target system sensitivity (SSe) which is the probability of detecting disease if it is present in the population at the specified animal and herd level design prevalences;
• The number of herds in the population (optional).

### Outputs

Outputs from the analysis include:

• The total numbers of herds to be sampled;
• The maximum total sample size (if animal-level prevalence is specified as a proportion);
• The numbers of animals to test in herd, for a range of herd sizes to achieve the specified value for SeH; and
• The numbers of animals to test in herd and the corresponding numbers of herds to test, for a range of herd sizes and SeH values.

Note:

1. If it is not possible to achieve the desired herd sensitivity by testing all animals in a herd of given size, the sample size is left blank;
2. If animal-level prevalence is specified as a number of animals, sample size for an unknown herd/flock size cannot be calculated;
3. If herd-level prevalence is specified as a number of herds, number of herds to be sampled for a large or unknown population cannot be calculated.
Animal-level design prevalence:
Proportion
Animal(s)
Herd-level design prevalence:
Proportion
Herd(s)
Test sensitivity:
Target Herd Sensitivity:
Target System Sensitivity (confidence):
Number of herds in the population (optional):

Top