Arrange a vector of individual risk probabilities in a matrix for informative array testing without master pooling.

informativeArrayProb(prob.vec, nr, nc, method = "sd")

Arguments

prob.vec

vector of individual risk probabilities, of length nr * nc.

nr

number of rows in the array.

nc

number of columns in the array.

method

character string defining the method to be used for matrix arrangement. Options include spiral ("sd") and gradient ("gd") arrangement. See McMahan et al. (2012) for additional details.

Value

A matrix of probabilities arranged according to the specified method.

References

McMahan, C., Tebbs, J., Bilder, C. (2012b). “Two-Dimensional Informative Array Testing.” Biometrics, 68, 793–804.

See also

expectOrderBeta for generating a vector of individual risk probabilities.

Author

This function was originally written by Christopher McMahan for McMahan et al. (2012). The function was obtained from http://chrisbilder.com/grouptesting/.

Examples

# Use the gradient arrangement method to create a matrix
#   of individual risk probabilities for a 10x10 array.
# Depending on the specified probability, alpha level,
#   and overall group size, simulation may be necessary
#   in order to generate the vector of individual
#   probabilities. This is done using the expectOrderBeta()
#   function and requires the user to set a seed in order
#   to reproduce results.
set.seed(1107)
p.vec1 <- expectOrderBeta(p = 0.05, alpha = 2, size = 100)
informativeArrayProb(prob.vec = p.vec1, nr = 10, nc = 10,
                     method = "gd")
#>             [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
#>  [1,] 0.17193388 0.09467980 0.07411090 0.06092015 0.05082629 0.04238657
#>  [2,] 0.14733559 0.09197756 0.07257579 0.05980526 0.04992281 0.04160348
#>  [3,] 0.13440942 0.08947726 0.07109986 0.05871781 0.04903450 0.04082921
#>  [4,] 0.12553848 0.08714856 0.06967801 0.05765607 0.04816056 0.04006328
#>  [5,] 0.11874115 0.08496750 0.06830576 0.05661848 0.04730023 0.03930523
#>  [6,] 0.11320756 0.08291482 0.06697916 0.05560359 0.04645278 0.03855460
#>  [7,] 0.10852663 0.08097481 0.06569469 0.05461006 0.04561756 0.03781097
#>  [8,] 0.10446071 0.07913448 0.06444923 0.05363666 0.04479392 0.03707390
#>  [9,] 0.10085984 0.07738296 0.06323996 0.05268226 0.04398125 0.03634299
#> [10,] 0.09762322 0.07571104 0.06206436 0.05174580 0.04317898 0.03561783
#>             [,7]       [,8]       [,9]       [,10]
#>  [1,] 0.03489803 0.02790982 0.02101030 0.013532122
#>  [2,] 0.03418320 0.02722337 0.02030504 0.012694949
#>  [3,] 0.03347295 0.02653750 0.01959398 0.011827597
#>  [4,] 0.03276690 0.02585177 0.01887608 0.010923045
#>  [5,] 0.03206466 0.02516568 0.01815016 0.009971580
#>  [6,] 0.03136587 0.02447872 0.01741488 0.008959079
#>  [7,] 0.03067012 0.02379034 0.01666868 0.007863560
#>  [8,] 0.02997705 0.02309997 0.01590972 0.006647294
#>  [9,] 0.02928624 0.02240697 0.01513584 0.005234706
#> [10,] 0.02859730 0.02171066 0.01434439 0.003423839

# Use the spiral arrangement method to create a matrix
#   of individual risk probabilities for a 5x5 array.
set.seed(8791)
p.vec2 <- expectOrderBeta(p = 0.02, alpha = 0.5, size = 25)
informativeArrayProb(prob.vec = p.vec2, nr = 5, nc = 5,
                     method = "sd")
#>      array.probs                                                
#> [1,] 0.102394783 0.044727562 0.01940464 0.006168446 0.0000533017
#> [2,] 0.070663665 0.054971408 0.02273105 0.007431183 0.0002845401
#> [3,] 0.037229961 0.031389840 0.02666103 0.008442638 0.0007324966
#> [4,] 0.016551849 0.014008839 0.01146482 0.009628169 0.0012278623
#> [5,] 0.004650901 0.003236871 0.00228025 0.001818588 0.0015719877