Learn R Programming

binGroup2 (version 1.1.0)

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

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.

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: Sterrett(), operatingCharacteristics1(), operatingCharacteristics2()

Examples

Run this code
# NOT RUN {
# 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)
# }

Run the code above in your browser using DataLab