plot.OTC {binGroup2}R Documentation

Plot method for optimal testing configuration results

Description

Produce a plot for objects of class "OTC" returned by OTC1 or OTC2.

Usage

## S3 method for class 'OTC'
plot(x, ...)

Arguments

x

an object of class "OTC", providing operating characteristics for the optimal testing configuration and similar configurations for a group testing algorithm.

...

currently not used.

Details

This function produces a plot for objects of class "OTC" returned by OTC1 or OTC2. It plots the expected number of tests per individual for each similar testing configuration in the object.

In addition to the OTC, the OTC1 and OTC2 functions provide operating characteristics for other configurations corresponding to each initial group size provided by the user. For algorithms where there is only one configuration for each initial group size (non-informative two-stage hierarchical and all array testing algorithms), results for each initial group size are plotted. For algorithms where there is more than one possible configuration for each initial group size (informative two-stage hierarchical and all three-stage hierarchical algorithms), the results corresponding to the best configuration for each initial group size are plotted.

If a single value is provided for the group.sz argument in the OTC1 or OTC2 functions, no plot will be produced.

The plot is produced using the ggplot2 package. Customization features from ggplot2 are available once the package is loaded. Examples are shown in the 'Examples' section.

Value

A plot of the expected number of tests per individual for similar configurations provided in the object.

Author(s)

Brianna D. Hitt

See Also

OTC1 and OTC2 for creating an object of class "OTC".

Examples

# Estimated running time for all examples was calculated 
#   using a computer with 16 GB of RAM and one core of 
#   an Intel i7-6500U processor. Please take this into 
#   account when interpreting the run time given.

# Find the optimal testing configuration for 
#   non-informative two-stage hierarchical testing.
res1 <- OTC1(algorithm = "D2", p = 0.01, Se = 0.99, Sp = 0.99, 
             group.sz = 3:100, obj.fn = c("ET", "MAR", "GR1"), 
             weights = matrix(data = c(1, 1), nrow = 1, ncol = 2))
plot(res1)

# Customize the plot using the ggplot2 package.
library(ggplot2)
plot(res1) + ylim(0,1) + 
  ggtitle("Similar configurations for Dorfman testing") + 
  theme(plot.title = element_text(hjust = 0.5))

# Find the optimal testing configuration for 
#   informative three-stage hierarchical testing
res2 <- OTC1(algorithm = "ID3", p = 0.025, 
             Se = c(0.95, 0.95, 0.99), Sp = c(0.96, 0.96, 0.98), 
             group.sz = 3:15, obj.fn = "ET", alpha = 2)
plot(res2)

# Find the optimal testing configuration for 
#   informative array testing without master pooling.
# This example takes approximately 30 seconds to run.

res3 <- OTC1(algorithm = "IA2", p = 0.05, alpha = 2, 
             Se = 0.90, Sp = 0.90, group.sz = 3:20, obj.fn = "ET")
plot(res3)

# Find the optimal testing configuration for 
#   informative two-stage hierarchical testing.
# This example takes approximately 30 seconds to run.
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)

res4 <- OTC2(algorithm = "ID2", alpha = c(18.25, 0.75, 0.75, 0.25), 
                Se = Se, Sp = Sp, group.sz = 12:20)
plot(res4)

# Find the optimal testing configuration for 
#   non-informative three-stage hierarchical testing.
# This example takes approximately 1 minute to run.
Se <- matrix(data = c(rep(0.95, 6)), nrow = 2, ncol = 3)
Sp <- matrix(data = c(rep(0.99, 6)), nrow = 2, ncol = 3)

res5 <- OTC2(algorithm = "D3", p.vec = c(0.95, 0.0275, 0.0175, 0.005), 
                Se = Se, Sp = Sp, group.sz = 5:20)
plot(res5)

# Find the optimal testing configuration for
#   non-informative array testing with master pooling.
# This example takes approximately 10 seconds to run.

res6 <- OTC2(algorithm = "A2M", p.vec = c(0.90, 0.04, 0.04, 0.02), 
             Se = rep(0.99, 2), Sp = rep(0.99, 2), group.sz = 3:20)
plot(res6)

[Package binGroup2 version 1.1.0 Index]