R/opCharMethodFunctions.R
summary.opChar.Rd
Produce a summary list for objects of class
"opChar" returned by operatingCharacteristics1
(opChar1) or operatingCharacteristics2
(opChar2).
# S3 method for class 'opChar'
summary(object, ...)
summary.opChar returns an object of class "summary.opChar", a list containing:
character string specifying the name of the group testing algorithm.
matrix detailing the configuration from object. For hierarchical testing, this includes the group sizes for each stage of testing. For array testing, this includes the array dimension (row/column size) and the array size (the total number of individuals in the array).
matrix detailing the expected number of tests and expected number of tests per individual from object
.
a list containing:
matrix detailing the accuracy measures for each
individual from object (for objects returned by opChar1
).
matrix detailing the accuracy measures
pertaining to disease 1 for each individual from object
(for objects returned by opChar2
).
matrix detailing the accuracy measures
pertaining to disease 2 for each individual from object
(for objects returned by opChar2
).
matrix detailing the overall accuracy measures for the algorithm from object.
This function produces a summary list for objects of
class "opChar" returned by operatingCharacteristics1
(opChar1) or operatingCharacteristics2
(opChar2). It formats the testing configuration, expected number
of tests, expected number of tests per individual, and accuracy measures.
The Configuration component of the result gives the testing configuration, which may include the group sizes for each stage of a hierarchical testing algorithm or the row/column size and array size for an array testing algorithm. The Tests component of the result gives the expected number of tests and the expected number of tests per individual for the algorithm.
The Accuracy component gives the individual accuracy measures for
each individual in object and the overall accuracy measures for the
algorithm. Accuracy measures included are the pooling sensitivity, pooling
specificity, pooling positive predictive value, and pooling negative
predictive value. The overall accuracy measures displayed are weighted
averages of the corresponding individual accuracy measures for all
individuals in the algorithm. Expressions for these averages are provided
in the Supplementary Material for Hitt et al. (2019). For more information,
see the Details' section for the operatingCharacteristics1
(opChar1) or operatingCharacteristics2
(opChar2)
function.
operatingCharacteristics1
(opChar1) and
operatingCharacteristics2
(opChar2) for creating
an object of class "opChar".
# Calculate the operating characteristics for
# non-informative four-stage hierarchical testing.
config.mat <- matrix(data = c(rep(1, 24), rep(1, 16),
rep(2, 8), rep(1, 8),
rep(2, 8), rep(3, 4),
rep(4, 2), rep(5, 2), 1:24),
nrow = 4, ncol = 24, byrow = TRUE)
calc1 <- opChar1(algorithm = "D4", p = 0.01,
Se = 0.99, Sp = 0.99,
hier.config = config.mat,
a = c(1, 9, 17, 21, 23))
#>
#> Number of minutes running: 0
#>
summary(calc1)
#>
#> Algorithm: Non-informative four-stage hierarchical testing
#>
#> Testing configuration:
#> Stage 1: 24
#> Stage 2: 16,8
#> Stage 3: 8,8,4,2,2
#>
#> Expected number of tests: 3.41
#> Expected number of tests per individual: 0.1420
#>
#> Accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9606 0.9993 0.9357 0.9996 1,9
#> 2 0.9606 0.9997 0.9708 0.9996 17
#> 3 0.9606 0.9999 0.9895 0.9996 21,23
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.9606 0.9995 0.9501 0.9996
#>
#> PSe denotes the pooling sensitivity.
#> PSp denotes the pooling specificity.
#> PPPV denotes the pooling positive predictive value.
#> PNPV denotes the pooling negative predictive value.
# Calculate the operating characteristics for
# informative array testing without master pooling.
calc2 <- opChar1(algorithm = "IA2", p = 0.025, alpha = 0.5,
Se = 0.95, Sp = 0.99, rowcol.sz = 10)
#>
#> Number of minutes running: 0.01
#>
summary(calc2)
#>
#> Algorithm: Informative array testing without master pooling
#>
#> Testing configuration:
#> Row/column size: 10
#> Array size: 100
#>
#> Expected number of tests: 25.62
#> Expected number of tests per individual: 0.2562
#>
#> Accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8732 0.9990 0.9947 0.9729 1
#> 2 0.8690 0.9990 0.9836 0.9908 2
#> 3 0.8679 0.9992 0.9795 0.9944 3
#> 4 0.8674 0.9994 0.9768 0.9963 4
#> 5 0.8670 0.9996 0.9746 0.9976 5
#> 6 0.8668 0.9997 0.9708 0.9985 6
#> 7 0.8666 0.9998 0.9681 0.9991 7
#> 8 0.8665 0.9999 0.9452 0.9997 8
#> 9 0.8665 0.9999 0.9254 0.9998 9
#> 10 0.8664 0.9999 0.8113 0.9999 10
#> 11 0.8730 0.9990 0.9931 0.9794 11
#> 12 0.8687 0.9991 0.9849 0.9913 12
#> 13 0.8677 0.9993 0.9812 0.9946 13
#> 14 0.8671 0.9995 0.9786 0.9964 14
#> 15 0.8668 0.9996 0.9765 0.9977 15
#> 16 0.8665 0.9997 0.9731 0.9985 16
#> 17 0.8664 0.9998 0.9675 0.9992 17
#> 18 0.8663 0.9999 0.9502 0.9997 18
#> 19 0.8662 0.9999 0.9143 0.9999 19
#> 20 0.8662 0.9999 0.7098 1.0000 20
#> 21 0.8728 0.9990 0.9920 0.9826 21
#> 22 0.8686 0.9992 0.9853 0.9917 22
#> 23 0.8675 0.9994 0.9818 0.9948 23
#> 24 0.8670 0.9995 0.9794 0.9966 24
#> 25 0.8666 0.9997 0.9773 0.9977 25
#> 26 0.8664 0.9998 0.9749 0.9985 26
#> 27 0.8662 0.9998 0.9678 0.9993 27
#> 28 0.8661 0.9999 0.9516 0.9997 28
#> 29 0.8661 0.9999 0.9159 0.9999 29
#> 30 0.8660 0.9999 0.5402 1.0000 30
#> 31 0.8727 0.9990 0.9912 0.9846 31
#> 32 0.8685 0.9992 0.9855 0.9922 32
#> 33 0.8674 0.9994 0.9822 0.9950 33
#> 34 0.8669 0.9996 0.9798 0.9967 34
#> 35 0.8665 0.9997 0.9777 0.9978 35
#> 36 0.8663 0.9998 0.9738 0.9987 36
#> 37 0.8661 0.9998 0.9675 0.9993 37
#> 38 0.8660 0.9999 0.9520 0.9997 38
#> 39 0.8660 0.9999 0.9112 0.9999 39
#> 40 0.8659 0.9999 0.3256 1.0000 40
#> 41 0.8726 0.9991 0.9905 0.9861 41
#> 42 0.8684 0.9993 0.9855 0.9925 42
#> 43 0.8673 0.9994 0.9824 0.9952 43
#> 44 0.8668 0.9996 0.9800 0.9969 44
#> 45 0.8664 0.9997 0.9779 0.9979 45
#> 46 0.8662 0.9998 0.9749 0.9987 46
#> 47 0.8660 0.9999 0.9670 0.9993 47
#> 48 0.8659 0.9999 0.9506 0.9997 48
#> 49 0.8659 0.9999 0.8952 0.9999 49
#> 50 0.8659 0.9999 0.1430 1.0000 50
#> 51 0.8726 0.9991 0.9900 0.9873 51
#> 52 0.8684 0.9993 0.9856 0.9929 52
#> 53 0.8673 0.9995 0.9826 0.9954 53
#> 54 0.8667 0.9996 0.9802 0.9970 54
#> 55 0.8664 0.9997 0.9782 0.9980 55
#> 56 0.8661 0.9998 0.9732 0.9988 56
#> 57 0.8660 0.9999 0.9642 0.9994 57
#> 58 0.8659 0.9999 0.9520 0.9997 58
#> 59 0.8658 0.9999 0.8939 0.9999 59
#> 60 0.8658 0.9999 0.0453 1.0000 60
#> 61 0.8725 0.9991 0.9896 0.9883 61
#> 62 0.8683 0.9993 0.9856 0.9932 62
#> 63 0.8672 0.9995 0.9828 0.9956 63
#> 64 0.8666 0.9996 0.9794 0.9972 64
#> 65 0.8663 0.9997 0.9766 0.9982 65
#> 66 0.8661 0.9998 0.9737 0.9989 66
#> 67 0.8659 0.9999 0.9651 0.9994 67
#> 68 0.8658 0.9999 0.9503 0.9997 68
#> 69 0.8658 0.9999 0.8848 0.9999 69
#> 70 0.8657 0.9999 0.0105 1.0000 70
#> 71 0.8724 0.9992 0.9891 0.9891 71
#> 72 0.8682 0.9994 0.9856 0.9936 72
#> 73 0.8672 0.9995 0.9828 0.9958 73
#> 74 0.8666 0.9996 0.9795 0.9973 74
#> 75 0.8662 0.9997 0.9748 0.9984 75
#> 76 0.8660 0.9998 0.9748 0.9989 76
#> 77 0.8659 0.9999 0.9663 0.9994 77
#> 78 0.8657 0.9999 0.9474 0.9998 78
#> 79 0.8657 0.9999 0.8743 0.9999 79
#> 80 0.8657 0.9999 0.0018 1.0000 80
#> 81 0.8724 0.9992 0.9888 0.9898 81
#> 82 0.8682 0.9994 0.9855 0.9938 82
#> 83 0.8671 0.9995 0.9828 0.9960 83
#> 84 0.8666 0.9997 0.9804 0.9973 84
#> 85 0.8662 0.9997 0.9754 0.9984 85
#> 86 0.8660 0.9998 0.9709 0.9990 86
#> 87 0.8658 0.9999 0.9660 0.9995 87
#> 88 0.8657 0.9999 0.9405 0.9998 88
#> 89 0.8657 0.9999 0.8598 0.9999 89
#> 90 0.8656 0.9999 0.0002 1.0000 90
#> 91 0.8724 0.9992 0.9884 0.9905 91
#> 92 0.8682 0.9994 0.9855 0.9941 92
#> 93 0.8671 0.9996 0.9828 0.9961 93
#> 94 0.8665 0.9997 0.9803 0.9974 94
#> 95 0.8662 0.9998 0.9763 0.9984 95
#> 96 0.8659 0.9998 0.9715 0.9991 96
#> 97 0.8658 0.9999 0.9564 0.9996 97
#> 98 0.8657 0.9999 0.9381 0.9998 98
#> 99 0.8656 0.9999 0.8583 0.9999 99
#> 100 0.8656 1.0000 0.0000 1.0000 100
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8697 0.9997 0.9846 0.9967
#>
#> PSe denotes the pooling sensitivity.
#> PSp denotes the pooling specificity.
#> PPPV denotes the pooling positive predictive value.
#> PNPV denotes the pooling negative predictive value.
# Calculate the operating characteristics for
# informative two-stage hierarchical testing
# with a multiplex assay for two diseases.
config.mat <- matrix(data = c(rep(1, 5), rep(2, 4),
1, 1:10),
nrow = 2, ncol = 10, byrow = TRUE)
Se <- matrix(data = c(rep(0.95, 2), rep(0.99, 2)),
nrow = 2, ncol = 2, byrow = FALSE)
Sp <- matrix(data = c(rep(0.96, 2), rep(0.98, 2)),
nrow = 2, ncol = 2, byrow = FALSE)
calc3 <- 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
#>
summary(calc3)
#>
#> Algorithm: Informative two-stage hierarchical testing
#>
#> Testing configuration:
#> Block size: 10
#> Group sizes: 6,4
#>
#> Expected number of tests: 5.38
#> Expected number of tests per individual: 0.5375
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9656 0.9887 0.0129 1.0000 1
#> 2 0.9622 0.9864 0.0714 1.0000 2
#> 3 0.9648 0.9040 0.2140 0.9989 3
#> 4 0.9599 0.9283 0.2893 0.9987 4
#> 5 0.9592 0.9603 0.2751 0.9993 5
#> 6 0.9736 0.9662 0.6921 0.9979 6
#> 7 0.9833 0.9761 0.6345 0.9993 7
#> 8 0.9583 0.9881 0.2530 0.9998 8
#> 9 0.9663 0.9486 0.7296 0.9949 9
#> 10 0.9562 0.9617 0.3706 0.9989 10
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9560 0.9808 0.2658 0.9997 1
#> 2 0.9560 0.9708 0.3404 0.9993 2
#> 3 0.9735 0.9446 0.1316 0.9998 3
#> 4 0.9554 0.9850 0.2075 0.9998 4
#> 5 0.9553 0.9614 0.4048 0.9987 5
#> 6 0.9797 0.9705 0.6294 0.9989 6
#> 7 0.9691 0.9524 0.6349 0.9972 7
#> 8 0.9558 0.9191 0.6176 0.9935 8
#> 9 0.9813 0.9745 0.6138 0.9992 9
#> 10 0.9551 0.8602 0.4796 0.9930 10
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.9681 0.9611 0.4657 0.9988
#> 2 0.9628 0.9532 0.5027 0.9981
#>
#> PSe denotes the pooling sensitivity.
#> PSp denotes the pooling specificity.
#> PPPV denotes the pooling positive predictive value.
#> PNPV denotes the pooling negative predictive value.
# Calculate the operating characteristics for
# non-informative array testing with master pooling
# with a multiplex assay for two diseases.
calc4 <- opChar2(algorithm = "A2M",
p.vec = c(0.92, 0.05, 0.02, 0.01),
Se = rep(0.95, 2), Sp = rep(0.99, 2),
rowcol.sz = 8)
#>
#> Number of minutes running: 0
#>
summary(calc4)
#>
#> Algorithm: Non-informative array testing with master pooling
#>
#> Testing configuration:
#> Row/column size: 8
#> Array size: 64
#>
#> Expected number of tests: 30.29
#> Expected number of tests per individual: 0.4733
#>
#> Disease 1 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.8704 0.9983 0.9709 0.9918 All
#>
#> Disease 2 accuracy for individuals:
#> PSe PSp PPPV PNPV Individuals
#> 1 0.9004 0.9981 0.9366 0.9969 All
#>
#> Overall accuracy of the algorithm:
#> PSe PSp PPPV PNPV
#> 1 0.8704 0.9983 0.9709 0.9918
#> 2 0.9004 0.9981 0.9366 0.9969
#>
#> PSe denotes the pooling sensitivity.
#> PSp denotes the pooling specificity.
#> PPPV denotes the pooling positive predictive value.
#> PNPV denotes the pooling negative predictive value.