R/operatingCharacteristics2.R
operatingCharacteristics2.Rd
Calculate operating characteristics, such as the expected number of tests, for a specified testing configuration using non-informative and informative hierarchical and array-based group testing algorithms. Multiplex assays for two diseases are used at each stage of the algorithms.
operatingCharacteristics2(
algorithm,
p.vec = NULL,
probabilities = NULL,
alpha = NULL,
Se,
Sp,
hier.config = NULL,
rowcol.sz = NULL,
ordering = matrix(data = c(0, 1, 0, 1, 0, 0, 1, 1), nrow = 4, ncol = 2),
a = NULL,
print.time = TRUE,
...
)
opChar2(
algorithm,
p.vec = NULL,
probabilities = NULL,
alpha = NULL,
Se,
Sp,
hier.config = NULL,
rowcol.sz = NULL,
ordering = matrix(data = c(0, 1, 0, 1, 0, 0, 1, 1), nrow = 4, ncol = 2),
a = NULL,
print.time = TRUE,
...
)
character string defining the group testing algorithm to be used. Non-informative testing options include two-stage hierarchical ("D2"), three-stage hierarchical ("D3"), four-stage hierarchical ("D4"), five-stage hierarchical ("D5"), square array testing without master pooling ("A2"), and square array testing with master pooling ("A2M"). Informative testing options include two-stage hierarchical ("ID2"), three-stage hierarchical ("ID3"), four-stage hierarchical ("ID4"), and five-stage hierarchical ("ID5") testing.
vector of overall joint probabilities. The joint probabilities are assumed to be equal for all individuals in the algorithm (non-informative testing only). There are four joint probabilities to consider: \(p_{00}\), the probability that an individual tests negative for both diseases; \(p_{10}\), the probability that an individual tests positive only for the first disease; \(p_{01}\), the probability that an individual tests positive only for the second disease; and \(p_{11}\), the probability that an individual tests positive for both diseases. The joint probabilities must sum to 1. Only one of p.vec, probabilities, or alpha should be specified.
matrix of joint probabilities for each individual, where rows correspond to the four joint probabilities and columns correspond to each individual in the algorithm. Only one of p.vec, probabilities, or alpha should be specified.
a vector containing positive shape parameters of the Dirichlet distribution (for informative testing only). The vector will be used to generate a heterogeneous matrix of joint probabilities for each individual. The vector must have length 4. Further details are given under 'Details'. Only one of p.vec, probabilities, or alpha should be specified.
matrix of sensitivity values, where one value is given for each disease (or infection) at each stage of testing. The rows of the matrix correspond to each disease \(k=1,2\), and the columns of the matrix correspond to each stage of testing \(s=1,...,S\). If a vector of 2 values is provided, the sensitivity values associated with disease are assumed to be equal to the \(k\)th value in the vector for all stages of testing. Further details are given under 'Details'.
a matrix of specificity values, where one value is given for each disease (or infection) at each stage of testing. The rows of the matrix correspond to each disease \(k=1,2\), and the columns of the matrix correspond to each stage of testing \(s=1,...,S\). If a vector of 2 values is provided, the specificity values associated with disease \(k\) are assumed to be equal to the \(k\)th value in the vector for all stages of testing. Further details are given under 'Details'.
a matrix specifying the configuration for a hierarchical testing algorithm. The rows correspond to the stages of testing, the columns correspond to each individual to be tested, and the cell values specify the group number of each individual at each stage. Further details are given under 'Details'. For array testing algorithms, this argument will be ignored.
the row/column size for array testing algorithms. For hierarchical testing algorithms, this argument will be ignored.
a matrix detailing the ordering for the binary responses of the diseases. The columns of the matrix correspond to each disease and the rows of the matrix correspond to each of the 4 sets of binary responses for two diseases. This ordering is used with the joint probabilities. The default ordering is (p_00, p_10, p_01, p_11).
a vector containing indices indicating which individuals to calculate individual accuracy measures for. If NULL, individual accuracy measures will be displayed for all individuals in the algorithm.
a logical value indicating whether the length of time for calculations should be printed. The default is TRUE.
additional arguments to be passed to functions for hierarchical testing with multiplex assays for two diseases.
A list containing:
the group testing algorithm used for calculations.
the vector of joint probabilities provided by the user, if applicable (for non-informative algorithms only).
the matrix of joint probabilities for each individual provided by the user, if applicable.
the alpha vector provided by the user, if applicable (for informative algorithms only).
the matrix of sensitivity values for each disease at each stage of testing.
the matrix of specificity values for each disease at each stage of testing.
a list specifying elements of the specified testing configuration, which may include:
group size for the first stage of hierarchical testing, if applicable.
group sizes for the second stage of hierarchical testing, if applicable.
group sizes for the third stage of hierarchical testing, if applicable.
group sizes for the fourth stage of hierarchical testing, if applicable.
the block size/initial group size for informative Dorfman testing, which is not tested.
group sizes for the first stage of testing for informative Dorfman testing.
the row/column size for array testing.
the overall array size for array testing (the square of the row/column size).
the matrix of joint probabilities for each individual in the algorithm. Each row corresponds to one of the four joint probabilities. Each column corresponds to an individual in the testing algorithm.
the expected testing expenditure for the OTC.
the value of the expected number of tests per individual.
a list containing:
a matrix of accuracy measures, pertaining to the first disease, for each individual specified in a. The rows correspond to each unique set of accuracy measures in the algorithm. Individuals with the same set of accuracy measures are displayed together in a single row of the matrix. The columns correspond to the pooling sensitivity, pooling specificity, pooling positive predictive value, pooling negative predictive value, and the indices for the individuals in each row of the matrix. Individual accuracy measures are not displayed for array testing algorithms.
a matrix of accuracy measures, pertaining to the second disease, for each individual specified in a. The rows correspond to each unique set of accuracy measures in the algorithm. Individuals with the same set of accuracy measures are displayed together in a single row of the matrix. The columns correspond to the pooling sensitivity, pooling specificity, pooling positive predictive value, pooling negative predictive value, and the indices for the individuals in each row of the matrix. Individual accuracy measures are not displayed for array testing algorithms.
a matrix of overall accuracy measures for the algorithm. The rows correspond to each disease. The columns correspond to the pooling sensitivity, pooling specificity, pooling positive predictive value, and pooling negative predictive value for the overall algorithm. Further details are given under 'Details'.
This function computes the operating characteristics for standard group testing algorithms with a multiplex assay that tests for two diseases. Calculations for hierarchical group testing algorithms are performed as described in Bilder et al. (2019) and calculations for array-based group testing algorithms are performed as described in Hou et al. (2019).
Available algorithms include two-, three-, four-, and five-stage hierarchical testing and array testing with and without master pooling. Both non-informative and informative group testing settings are allowed for hierarchical algorithms. Only non-informative group testing settings are allowed for array testing algorithms. Operating characteristics calculated are expected number of tests, pooling sensitivity, pooling specificity, pooling positive predictive value, and pooling negative predictive value for each individual.
For informative algorithms where the alpha argument is specified, a
heterogeneous matrix of joint probabilities for each individual is generated
using the Dirichlet distribution. This is done using
rBeta2009::rdirichlet
and requires the user to set a seed to
reproduce results. See Bilder et al. (2019) for additional details on the
use of the Dirichlet distribution for this purpose.
The sensitivity/specificity values are allowed to vary across stages of testing. For hierarchical testing, a different sensitivity/specificity value may be used for each stage of testing. For array testing, a different sensitivity/specificity value may be used for master pool testing (if included), row/column testing, and individual testing. The values must be specified in the order of the testing performed. For example, values are specified as (stage 1, stage 2, stage 3) for three-stage hierarchical testing or (master pool testing, row/column testing, individual testing) for array testing with master pooling. A vector of 2 sensitivity/specificity values may be specified, and sensitivity/specificity values for all stages of testing are assumed to be equal. The first value in the vector will be used at each stage of testing for the first disease, and the second value in the vector will be used at each stage of testing for the second disease.
The matrix specified by hier.config defines the hierarchical group testing algorithm for \(I\) individuals. The rows of the matrix correspond to the stages \(s=1,...,S\) in the testing algorithm, and the columns correspond to individuals \(i=1,...I\). The cell values within the matrix represent the group number of individual \(i\) at stage \(s\). For three-stage, four-stage, five-stage, and non-informative two-stage hierarchical testing, the first row of the matrix consists of all ones. This indicates that all individuals in the algorithm are tested together in a single group in the first stage of testing. For informative two-stage hierarchical testing, the initial group (block) is not tested. Thus, the first row of the matrix consists of the group numbers for each individual in the first stage of testing. For all hierarchical algorithms, the final row of the matrix denotes individual testing. Individuals who are not tested in a particular stage are represented by "NA" (e.g., an individual tested in a group of size 1 in the second stage of testing would not be tested again in a third stage of testing). It is important to note that this matrix represents the testing that could be performed if each group tests positively at each stage prior to the last. For more details on this matrix (called a group membership matrix), see Bilder et al. (2019).
For array testing without master pooling, the rowcol.sz specified represents the row/column size for initial (stage 1) testing. For array testing with master pooling, the rowcol.sz specified represents the row/column size for stage 2 testing. This is because the master pool size is the overall array size, given by the square of the row/column size.
The displayed overall 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 (or block) for a hierarchical algorithm, or within the entire array for an array-based algorithm. Expressions for these averages are provided in the Supplementary Material for Hitt et al. (2019). These expressions are based on accuracy definitions given by Altman and Bland (1994a, 1994b).
This function returns the pooling positive and negative predictive values for all individuals even though these measures are diagnostic specific; e.g., the pooling positive predictive value should only be considered for those individuals who have tested positive.
Additionally, only stage dependent sensitivity and specificity values are allowed within the program (no group within stage dependent values are allowed). See Bilder et al. (2019) for additional information.
Altman, D., Bland, J. (1994). “Diagnostic tests 1: Sensitivity and specificity.” BMJ, 308, 1552.
Altman, D., Bland, J. (1994). “Diagnostic tests 2: Predictive values.” BMJ, 309, 102.
Bilder, C., Tebbs, J., McMahan, C. (2019). “Informative group testing for multiplex assays.” Biometrics, 75, 278–288.
Hitt, B., Bilder, C., Tebbs, J., McMahan, C. (2019). “The objective function controversy for group testing: Much ado about nothing?” Statistics in Medicine, 38, 4912–4923.
Hou, P., Tebbs, J., Wang, D., McMahan, C., Bilder, C. (2021). “Array testing with multiplex assays.” Biostatistics, 21, 417–431.
McMahan, C., Tebbs, J., Bilder, C. (2012a). “Informative Dorfman Screening.” Biometrics, 68, 287–296.
Other operating characteristic functions:
GroupMembershipMatrix()
,
Sterrett()
,
TOD()
,
halving()
,
operatingCharacteristics1()
# Calculate the operating characteristics for
# non-informative two-stage hierarchical
# (Dorfman) testing.
config.mat <- matrix(data = c(rep(1, 24), 1:24),
nrow = 2, ncol = 24, byrow = TRUE)
Se <- matrix(data = c(0.95, 0.95, 0.95, 0.95),
nrow = 2, ncol = 2,
dimnames = list(Infection = 1:2, Stage = 1:2))
Sp <- matrix(data = c(0.99, 0.99, 0.99, 0.99),
nrow = 2, ncol = 2,
dimnames = list(Infection = 1:2, Stage = 1:2))
opChar2(algorithm = "D2", p.vec = c(0.90, 0.04, 0.04, 0.02),
Se = Se, Sp = Sp, hier.config = config.mat, print.time = FALSE)
#>
#> Algorithm: Non-informative two-stage hierarchical testing
#>
#> Testing configuration:
#> Stage1
#> 1 24
#>
#> Expected number of tests: 22.7375
#> Expected number of tests per individual: 0.9474
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9405 0.9910 0.8696 0.9962 All
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9405 0.9910 0.8696 0.9962 All
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.9405 0.9910 0.8696 0.9962
#> 2 0.9405 0.9910 0.8696 0.9962
# Calculate the operating characteristics for informative
# two-stage hierarchical (Dorfman) testing.
# A matrix of joint probabilities for each individual is
# generated using the Dirichlet distribution.
config.mat <- matrix(data = c(rep(1, 5), rep(2, 4), 3, 1:9, NA),
nrow = 2, ncol = 10, byrow = TRUE)
Se <- matrix(data = c(0.95, 0.95, 0.99, 0.99),
nrow = 2, ncol = 2,
dimnames = list(Infection = 1:2, Stage = 1:2))
Sp <- matrix(data = c(0.96, 0.96, 0.98, 0.98),
nrow = 2, ncol = 2,
dimnames = list(Infection = 1:2, Stage = 1:2))
set.seed(8791)
opChar2(algorithm = "ID2", alpha = c(18.25, 0.75, 0.75, 0.25),
Se = Se, Sp = Sp, hier.config = config.mat)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Informative two-stage hierarchical testing
#>
#> Testing configuration:
#> Block.sz pool.szs
#> 1 10 5,4,1
#>
#> Expected number of tests: 5.8242
#> Expected number of tests per individual: 0.5824
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9753 0.9865 0.0272 1.0000 1
#> 2 0.9650 0.9244 0.2261 0.9991 2
#> 3 0.9803 0.8352 0.1660 0.9992 3
#> 4 0.9622 0.8839 0.2603 0.9982 4
#> 5 0.9820 0.9590 0.1273 0.9999 5
#> 6 0.9657 0.9415 0.5234 0.9976 6
#> 7 0.9601 0.9584 0.5311 0.9980 7
#> 8 0.9846 0.8696 0.4664 0.9980 8
#> 9 0.9685 0.9505 0.4958 0.9983 9
#> 10 0.9500 0.9600 0.8458 0.9881 10
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9625 0.9647 0.4600 0.9988 1
#> 2 0.9660 0.9556 0.3354 0.9992 2
#> 3 0.9782 0.8463 0.1970 0.9990 3
#> 4 0.9652 0.9689 0.3213 0.9995 4
#> 5 0.9643 0.9210 0.4310 0.9976 5
#> 6 0.9829 0.9743 0.3496 0.9998 6
#> 7 0.9613 0.9631 0.5498 0.9981 7
#> 8 0.9855 0.8727 0.4639 0.9982 8
#> 9 0.9660 0.9281 0.5613 0.9965 9
#> 10 0.9500 0.9600 0.7370 0.9939 10
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.9644 0.9270 0.4347 0.9978
#> 2 0.9671 0.9360 0.4507 0.9981
# Equivalent code using a heterogeneous matrix of joint
# probabilities for each individual
set.seed(8791)
p.unordered <- t(rBeta2009::rdirichlet(n = 10,
shape = c(18.25, 0.75, 0.75, 0.25)))
p.ordered <- p.unordered[, order(1 - p.unordered[1,])]
opChar2(algorithm = "ID2", probabilities = p.ordered,
Se = Se, Sp = Sp, hier.config = config.mat)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Informative two-stage hierarchical testing
#>
#> Testing configuration:
#> Block.sz pool.szs
#> 1 10 5,4,1
#>
#> Expected number of tests: 5.8242
#> Expected number of tests per individual: 0.5824
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9753 0.9865 0.0272 1.0000 1
#> 2 0.9650 0.9244 0.2261 0.9991 2
#> 3 0.9803 0.8352 0.1660 0.9992 3
#> 4 0.9622 0.8839 0.2603 0.9982 4
#> 5 0.9820 0.9590 0.1273 0.9999 5
#> 6 0.9657 0.9415 0.5234 0.9976 6
#> 7 0.9601 0.9584 0.5311 0.9980 7
#> 8 0.9846 0.8696 0.4664 0.9980 8
#> 9 0.9685 0.9505 0.4958 0.9983 9
#> 10 0.9500 0.9600 0.8458 0.9881 10
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9625 0.9647 0.4600 0.9988 1
#> 2 0.9660 0.9556 0.3354 0.9992 2
#> 3 0.9782 0.8463 0.1970 0.9990 3
#> 4 0.9652 0.9689 0.3213 0.9995 4
#> 5 0.9643 0.9210 0.4310 0.9976 5
#> 6 0.9829 0.9743 0.3496 0.9998 6
#> 7 0.9613 0.9631 0.5498 0.9981 7
#> 8 0.9855 0.8727 0.4639 0.9982 8
#> 9 0.9660 0.9281 0.5613 0.9965 9
#> 10 0.9500 0.9600 0.7370 0.9939 10
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.9644 0.9270 0.4347 0.9978
#> 2 0.9671 0.9360 0.4507 0.9981
# Calculate the operating characteristics for
# non-informative three-stage hierarchical testing.
config.mat <- matrix(data = c(rep(1, 10), rep(1, 5),
rep(2, 4), 3, 1:9, NA),
nrow = 3, ncol = 10, byrow = TRUE)
Se <- matrix(data = rep(0.95, 6), nrow = 2, ncol = 3,
dimnames = list(Infection = 1:2, Stage = 1:3))
Sp <- matrix(data = rep(0.99, 6), nrow = 2, ncol = 3,
dimnames = list(Infection = 1:2, Stage = 1:3))
opChar2(algorithm = "D3", p.vec = c(0.95, 0.02, 0.02, 0.01),
Se = Se, Sp = Sp, hier.config = config.mat)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Non-informative three-stage hierarchical testing
#>
#> Testing configuration:
#> Stage1 Stage2
#> 1 10 5,4,1
#>
#> Expected number of tests: 3.9765
#> Expected number of tests per individual: 0.3977
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8975 0.9981 0.9354 0.9968 1,2,3,4,5
#> 2 0.8966 0.9985 0.9476 0.9968 6,7,8,9
#> 3 0.9250 0.9962 0.8824 0.9977 10
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8975 0.9981 0.9354 0.9968 1,2,3,4,5
#> 2 0.8966 0.9985 0.9476 0.9968 6,7,8,9
#> 3 0.9250 0.9962 0.8824 0.9977 10
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8999 0.9980 0.9344 0.9969
#> 2 0.8999 0.9980 0.9344 0.9969
opChar2(algorithm = "D3", p.vec = c(0.95, 0.02, 0.02, 0.01),
Se = Se, Sp = Sp, hier.config = config.mat,
a = c(1, 6, 10))
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Non-informative three-stage hierarchical testing
#>
#> Testing configuration:
#> Stage1 Stage2
#> 1 10 5,4,1
#>
#> Expected number of tests: 3.9765
#> Expected number of tests per individual: 0.3977
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8975 0.9981 0.9354 0.9968 1
#> 2 0.8966 0.9985 0.9476 0.9968 6
#> 3 0.9250 0.9962 0.8824 0.9977 10
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8975 0.9981 0.9354 0.9968 1
#> 2 0.8966 0.9985 0.9476 0.9968 6
#> 3 0.9250 0.9962 0.8824 0.9977 10
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8999 0.9980 0.9344 0.9969
#> 2 0.8999 0.9980 0.9344 0.9969
# Calculate the operating characteristics for informative
# three-stage hierarchical testing.
# A matrix of joint probabilities for each individual is
# generated using the Dirichlet distribution.
config.mat <- matrix(data = c(rep(1, 15),
rep(c(1, 2, 3), each = 5), 1:15),
nrow = 3, ncol = 15, byrow = TRUE)
Se <- matrix(data = rep(0.95, 6), nrow = 2, ncol = 3,
dimnames = list(Infection = 1:2, Stage = 1:3))
Sp <- matrix(data = rep(0.99, 6), nrow = 2, ncol = 3,
dimnames = list(Infection = 1:2, Stage = 1:3))
opChar2(algorithm = "ID3", alpha = c(18.25, 0.75, 0.75, 0.25),
Se = Se, Sp = Sp, hier.config = config.mat)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Informative three-stage hierarchical testing
#>
#> Testing configuration:
#> Stage1 Stage2
#> 1 15 5,5,5
#>
#> Expected number of tests: 6.5272
#> Expected number of tests per individual: 0.4351
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8899 0.9987 0.3819 0.9999 1
#> 2 0.9401 0.9988 0.8075 0.9997 2
#> 3 0.8863 0.9987 0.7019 0.9996 3
#> 4 0.9371 0.9989 0.9589 0.9983 4
#> 5 0.9161 0.9987 0.7964 0.9996 5
#> 6 0.8795 0.9979 0.9252 0.9965 6
#> 7 0.8853 0.9978 0.8743 0.9980 7
#> 8 0.8804 0.9980 0.9524 0.9947 8
#> 9 0.9029 0.9979 0.9264 0.9972 9
#> 10 0.8872 0.9982 0.9696 0.9927 10
#> 11 0.8880 0.9966 0.9556 0.9907 11
#> 12 0.9048 0.9963 0.9075 0.9962 12
#> 13 0.8853 0.9964 0.9390 0.9929 13
#> 14 0.9075 0.9966 0.9540 0.9927 14
#> 15 0.9416 0.9964 0.9206 0.9974 15
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8800 0.9987 0.6786 0.9996 1
#> 2 0.8922 0.9989 0.9497 0.9975 2
#> 3 0.8781 0.9989 0.9455 0.9973 3
#> 4 0.9191 0.9990 0.9724 0.9970 4
#> 5 0.8819 0.9990 0.9753 0.9950 5
#> 6 0.8811 0.9978 0.8786 0.9979 6
#> 7 0.8853 0.9979 0.9323 0.9963 7
#> 8 0.8817 0.9978 0.7835 0.9989 8
#> 9 0.8999 0.9980 0.9422 0.9963 9
#> 10 0.9128 0.9978 0.8526 0.9988 10
#> 11 0.8899 0.9961 0.3152 0.9998 11
#> 12 0.8973 0.9965 0.9443 0.9932 12
#> 13 0.8835 0.9964 0.9186 0.9946 13
#> 14 0.9088 0.9965 0.9496 0.9934 14
#> 15 0.9049 0.9969 0.9752 0.9872 15
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8991 0.9978 0.9334 0.9965
#> 2 0.8976 0.9978 0.9359 0.9963
# Calculate the operating characteristics for
# non-informative four-stage hierarchical testing.
config.mat <- matrix(data = c(rep(1, 12), rep(1, 6), rep(2, 6),
rep(1, 4), rep(2, 2), rep(3, 3),
rep(4, 3), 1:12),
nrow = 4, ncol = 12, byrow = TRUE)
Se <- matrix(data = rep(0.95, 8), nrow = 2, ncol = 4,
dimnames = list(Infection = 1:2, Stage = 1:4))
Sp <- matrix(data = rep(0.99, 8), nrow = 2, ncol = 4,
dimnames = list(Infection = 1:2, Stage = 1:4))
opChar2(algorithm = "D4", p.vec = c(0.92, 0.05, 0.02, 0.01),
Se = Se, Sp = Sp, hier.config = config.mat)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Non-informative four-stage hierarchical testing
#>
#> Testing configuration:
#> Stage1 Stage2 Stage3
#> 1 12 6,6 4,2,3,3
#>
#> Expected number of tests: 6.2334
#> Expected number of tests per individual: 0.5195
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8548 0.9979 0.9621 0.9908 1,2,3,4
#> 2 0.8526 0.9991 0.9831 0.9907 5,6
#> 3 0.8537 0.9984 0.9720 0.9907 7,8,9,10,11,12
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8840 0.9977 0.9209 0.9964 1,2,3,4
#> 2 0.8807 0.9988 0.9586 0.9963 5,6
#> 3 0.8824 0.9982 0.9385 0.9964 7,8,9,10,11,12
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8539 0.9983 0.9705 0.9907
#> 2 0.8826 0.9981 0.9358 0.9964
# Calculate the operating characteristics for informative
# five-stage hierarchical testing.
# A matrix of joint probabilities for each individual is
# generated using the Dirichlet distribution.
config.mat <- matrix(data = c(rep(1, 20), rep(1, 10), rep(2, 10),
rep(c(1, 2, 3, 4), each = 5),
rep(1, 3), rep(2, 2), rep(3, 3),
rep(4, 2), rep(5, 3), rep(6, 2),
rep(7, 3), rep(8, 2), 1:20),
nrow = 5, ncol = 20, byrow = TRUE)
Se <- matrix(data = rep(0.95, 10), nrow = 2, ncol = 5,
dimnames = list(Infection = 1:2, Stage = 1:5))
Sp <- matrix(data = rep(0.99, 10), nrow = 2, ncol = 5,
dimnames = list(Infection = 1:2, Stage = 1:5))
opChar2(algorithm = "ID5", alpha = c(18.25, 0.75, 0.75, 0.25),
Se = Se, Sp = Sp, hier.config = config.mat)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Informative five-stage hierarchical testing
#>
#> Testing configuration:
#> Stage1 Stage2 Stage3 Stage4
#> 1 20 10,10 5,5,5,5 3,2,3,2,3,2,3,2
#>
#> Expected number of tests: 10.9673
#> Expected number of tests per individual: 0.5484
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 NA NA NA NA <NA>
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 NA NA NA NA <NA>
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8485 0.9986 0.9747 0.9907
#> 2 0.8685 0.9985 0.9611 0.9945
# Calculate the operating characteristics for
# non-informative array testing without master pooling.
Se <- matrix(data = rep(0.95, 4), nrow = 2, ncol = 2,
dimnames = list(Infection = 1:2, Stage = 1:2))
Sp <- matrix(data = rep(0.99, 4), nrow = 2, ncol = 2,
dimnames = list(Infection = 1:2, Stage = 1:2))
opChar2(algorithm = "A2", p.vec = c(0.90, 0.04, 0.04, 0.02),
Se = Se, Sp = Sp, rowcol.sz = 12)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Non-informative array testing without master pooling
#>
#> Testing configuration:
#> Array.dim Array.sz
#> 1 12 144
#>
#> Expected number of tests: 85.9259
#> Expected number of tests per individual: 0.5967
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8991 0.9960 0.9353 0.9936 All
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8991 0.9960 0.9353 0.9936 All
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8991 0.9960 0.9353 0.9936
#> 2 0.8991 0.9960 0.9353 0.9936
# Calculate the operating characteristics for
# non-informative array testing with master pooling.
Se <- matrix(data = rep(0.95, 6), nrow = 2, ncol = 3,
dimnames = list(Infection = 1:2, Stage = 1:3))
Sp <- matrix(data = rep(0.99, 6), nrow = 2, ncol = 3,
dimnames = list(Infection = 1:2, Stage = 1:3))
opChar2(algorithm = "A2M", p.vec = c(0.90, 0.04, 0.04, 0.02),
Se = Se, Sp = Sp, rowcol.sz = 10)
#>
#> Number of minutes running: 0
#>
#>
#> Algorithm: Non-informative array testing with master pooling
#>
#> Testing configuration:
#> Array.dim Array.sz
#> 1 10 100
#>
#> Expected number of tests: 56.2898
#> Expected number of tests per individual: 0.5629
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8937 0.9968 0.9475 0.9932 All
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8937 0.9968 0.9475 0.9932 All
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8937 0.9968 0.9475 0.9932
#> 2 0.8937 0.9968 0.9475 0.9932