# Analysis of 2-stage freedom survey data

Analyse cluster-testing data for 2-stage surveys for demonstrating disease freedom. This analysis calculates the overall system sensitivity for the survey and the resulting probability of population freedom from disease. It assumes that a random sample of clusters (or all clusters) has been selected for testing from the population and that a random sample of units (or all units) has been tested within each selected clusters. It also assumes that the test system has a specificity of 100% (any positive results are further investigated to exclude false positives) and that no positive results were recorded. The analysis adjusts for imperfect sensitivity of the test used.

The analysis calculates both cluster and system (population) level sensitivity estimates using three different methods depending on the available data:

- - assumed binomial sampling (sampling with replacement) where population size is unknown or not specified;
- - a hypergeometric approximation (sampling without replacement) where population size is specified; or
- - exact probability calculations where the entire population has been sampled.

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

- - a proportion of the population infected; or
- - a specific (integer) number of clusters or units (within clusters) infected.

### Inputs

Inputs required include:

- - unit-level design prevalence as either a proportion or an integer number of units;
- - cluster-level design prevalence as either a proportion or an integer number of clusters;
- - the number of clusters in the population as either unknown, all clusters tested or a specified number of clusters;
- - the estimated test sensitivity;
- - the assumed prior probability that the population is free of disease; and
- - testing data for each clusters, including clusters id (optional), number of units tested and (optionally) clusters size. Cluster size is required if unit-level design prevalence is specified as number rather than proportion of units.

### Outputs

Outputs from the analysis include:

- - Overall system sensitivity (probability of detecting disease if it was present at the specified unit and cluster-level design prevalences);
- - Probability of freedom of the population from disease (at the specified unit and cluster-level design prevalences; and
- - A summary of cluster-level sensitivity (SeH) values and specific values for each cluster tested.