halving {binGroup2} R Documentation

## Probability mass function for halving

### Description

Calculate the probability mass function for the number of tests from using the halving algorithm.

### Usage

```halving(p, sp = 1, se = 1, stages = 2, order.p = TRUE)
```

### Arguments

 `p` a vector of individual risk probabilities. `sp` the specificity of the diagnostic test. `se` the sensitivity of the diagnostic test. `stages` the number of stages for the halving algorithm. `order.p` logical; if TRUE, the vector of individual risk probabilities will be sorted.

### Details

Halving algorithms involve successively splitting a positive testing group into two equal-sized halves (or as close to equal as possible) until all individuals have been identified as positive or negative. S-stage halving begins by testing the whole group of I individuals. Positive groups are split in half until the final stage of the algorithm, which consists of individual testing. For example, consider an initial group of size I=16 individuals. Three-stage halving (3H) begins by testing the whole group of 16 individuals. If this group tests positive, the second stage involves splitting into two groups of size 8. If either of these groups test positive, a third stage involves testing each individual rather than halving again. Four-stage halving (4H) would continue with halving into groups of size 4 before individual testing. Five-stage halving (5H) would continue with halving into groups of size 2 before individual testing. 3H requires more than 2 individuals, 4H requires more than 4 individuals, and 5H requires more than 8 individuals.

This function calculates the probability mass function, expected testing expenditure, and variance of the testing expenditure for halving algorithms with 3 to 5 stages.

### Value

A list containing:

 `pmf` the probability mass function for the halving algorithm. `et` the expected testing expenditure for the halving algorithm. `vt` the variance of the testing expenditure for the halving algorithm.

### Author(s)

This function was originally written by Michael Black for Black et al. (2012). The function was obtained from http://chrisbilder.com/grouptesting/. Minor modifications have been made for inclusion of the function in the `binGroup2` package.

### References

Black, M., Bilder, C., Tebbs, J. (2012). “Group testing in heterogeneous populations by using halving algorithms.” Journal of the Royal Statistical Society. Series C: Applied Statistics, 61, 277–290. doi: 10.1111/j.1467-9876.2011.01008.x, https://doi.org/10.1111/j.1467-9876.2011.01008.x.

`expectOrderBeta` for generating a vector of individual risk probabilities for informative group testing.

Other operating characteristic functions: `Sterrett()`, `operatingCharacteristics1()`, `operatingCharacteristics2()`

### Examples

```# Equivalent to Dorfman testing (two-stage hierarchical)
halving(p = rep(0.01, 10), sp = 1, se = 1, stages = 2,
order.p = TRUE)

# Halving over three stages; each individual has a
#   different probability of being positive
set.seed(12895)
p.vec <- expectOrderBeta(p = 0.05, alpha = 2, size = 20)
halving(p = p.vec, sp = 0.95, se = 0.95, stages = 3,
order.p = TRUE)
```

[Package binGroup2 version 1.1.0 Index]