Learn R Programming

binGroup2 (version 1.3.1)

halving: Probability mass function for halving

Description

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

Usage

halving(p, Se = 1, Sp = 1, stages = 2, order.p = TRUE)

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.

p

a vector containing the probabilities of positivity for each individual.

Arguments

p

a vector of individual risk probabilities.

Se

sensitivity of the diagnostic test.

Sp

specificity 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.

Author

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.

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.

References

Black2012binGroup2

See Also

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

Other operating characteristic functions: GroupMembershipMatrix(), Sterrett(), TOD(), operatingCharacteristics1(), operatingCharacteristics2()

Examples

Run this code
# Equivalent to Dorfman testing (two-stage hierarchical)
halving(p = rep(0.01, 10), Se = 1, Sp = 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, Se = 0.95, Sp = 0.95, stages = 3,
        order.p = TRUE)

Run the code above in your browser using DataLab