# hierarchical.desc2: Operating characteristics for hierarchical group testing In binGroup: Evaluation and Experimental Design for Binomial Group Testing

## Description

Calculate operating characteristics for hierarchical group testing with up to four stages, given a vector of individual probabilities and a testing configuration.

## Usage

 1 2 hierarchical.desc2(p, I2 = NULL, I3 = NULL, se = 1, sp = 1, order.p = TRUE)

## Arguments

 p vector of probabilities corresponding to each individual's risk of disease. I2 a numeric vector of pool sizes for stage 2 testing (used in hierarchical testing with at least three stages). I3 a numeric vector of pool sizes for stage 3 testing (used in hierarchical testing with at least four stages). se the sensitivity of the diagnostic test. sp the specificity of the diagnostic test. order.p a logical value indicating whether the vector of individual probabilities needs to be sorted.

## Details

This function calculates the operating characteristics for hierarchical group testing with up to four stages of testing. Operating characteristics calculated are expected number of tests, and pooling sensitivity, pooling specificity, pooling positive predictive value, and pooling negative predictive value, for each individual and for the configuration overall.

If I2 is NULL, there are two stages of testing. If I3 is NULL but I2 has values, there are three stages of testing. If both I2 and I3 have values, there are four stages of testing.

Vectors I2 and I3 should be entered using notation that keeps track of all individuals through all stages (e.g. for a group of 10 individuals that splits into 5, 4, and 1 individual at stage 2, then into 3, 2, 2, 1, and 1 individual at stage 3 before individual testing at stage 4, then I2=c(5,4,1) and I3=c(3,2,2,1,1,1) so that the specimen that was tested individually at stage 2 is still numbered at stage 3 even though it will not be tested again).

The displayed pooling sensitivity, pooling specificity, pooling positive predictive value, and pooling negative predictive value are weighted averages of the corresponding individual accuracy measures for all individuals within the initial group for a hierarchical algorithm. Expressions for these averages are provided in the Supplementary Material for Hitt et al. (2018). These expressions are based on accuracy definitions given by Altman and Bland (1994a, 1994b).

## Value

A list containing:

 ET the expected number of tests. stages the number of stages in the testing algorithm. group.size the total number of individuals tested in the algorithm. I2 pool sizes for the second stage of testing, or "individual testing" if there are only two stages of testing. I3 pool sizes for the third stage of testing, or "individual testing" if there are only three stages of testing. m1 the initial (stage 1) group size for two stage testing, or the number of subgroups originating from the initial group. m2 the number of subgroups for each preceding group containing more than one individual, or "individual testing" if there are only two stages of testing. m3 the number of subgroups for each preceding group containing more than one individual, or "individual testing" if there are only three stages of testing. NULL if there are only two stages of testing. individual.testerror a data frame containing: pse.veca vector containing each individual's pooling sensitivity. psp.veca vector containing each individual's pooling specificity. pppv.veca vector containing each individual's pooling positive predictive value. pnpv.veca vector containing each individual's pooling negative predictive value. group.testerror a vector containing: PSethe overall pooling sensitivity for the algorithm. Further details are given under 'Details'. PSpthe overall pooling specificity for the algorithm. Further details are given under 'Details'. PPPVthe overall pooling positive predictive value for the algorithm. Further details are given under 'Details'. PNPVthe overall pooling negative predictive value for the algorithm. Further details are given under 'Details'. individual.probabilities a vector containing each individual's probability of disease. If order.p=TRUE, this is the sorted vector of individual probabilities.

## Note

This function returns the pooling positive and negative predictive values for all individuals even though these measures are diagnostic specific; i.e., PPPV (PNPV) should only be considered for those individuals who have tested positive (negative).

## Author(s)

This function was originally written by Michael S. Black for Black et al. (2015). The function was obtained from http://chrisbilder.com/grouptesting. Minor modifications were made to the function for inclusion in the binGroup package.

## References

\insertRef

Black2015binGroup