Skip to contents

Computes the operating characteristics of several designs under the same scenarios, for example designs with different sample sizes, prior distributions, external data or thresholds, and collects them in one table with a column that names the design.

Usage

qdm_compare(designs, scenarios, nsim = 10000L, seed = NULL)

Arguments

designs

A list of designs (created by a design_*() function such as design_binary) or design specifications (started by qdm_endpoint), all for the same endpoint. The names of the list name the designs; designs without a name are called "Design 1", "Design 2" and so on, by their position.

scenarios

A data frame of scenarios with the columns needed by all the designs (see qdm_oc and qdm_scenarios). It must not have a column named design.

nsim, seed

As in qdm_oc.

Value

An object of class c("qdm_comparison", "data.frame"): the column design (a factor with the names of the designs as levels, in the order of designs), followed by the columns of the results of qdm_oc (the scenarios and the probabilities of the decisions). The attribute designs is the list of the designs (built from the specifications) and the attribute method the methods of computation, named by the designs.

Details

Each design is computed by qdm_oc with the same scenarios, nsim and seed, so the rows of a design are those of qdm_oc() for that design alone. With a seed, the simulated studies of all designs start from the same random numbers. The warnings of qdm_oc() (Miss decisions, scenarios that are not evaluable) start with the name of the design.

Designs that differ in one part can be made from one design with the design steps (see qdm_endpoint), which accept a design; for example, for several sample sizes, lapply(c(12, 18, 24), function(n) qdm_sample_size(des, n, n)).

Examples

des <- design_binary(
  n_t = 12, n_c = 12,
  prior_t = prior_beta(0.5, 0.5), prior_c = prior_beta(0.5, 0.5),
  criterion = criterion_posterior(theta_tv = 0.2, theta_mav = 0.1,
                                  gamma_go = 0.5, gamma_nogo = 0.8)
)
n <- c(12, 18, 24)
designs <- lapply(n, function(k) qdm_sample_size(des, n_t = k, n_c = k))
names(designs) <- paste(n, "per group")
cmp <- qdm_compare(designs, qdm_scenarios(des, theta = seq(0, 0.4, by = 0.1),
                                          pi_c = 0.3))
cmp
#> Operating characteristics of 3 designs
#> Method: exact enumeration of the outcomes
#>        design theta pi_t pi_c      Go     NoGo    Gray Miss
#>  12 per group   0.0  0.3  0.3 0.13165 0.416956 0.45139    0
#>  12 per group   0.1  0.4  0.3 0.28929 0.232488 0.47822    0
#>  12 per group   0.2  0.5  0.3 0.48831 0.109372 0.40232    0
#>  12 per group   0.3  0.6  0.3 0.68750 0.041368 0.27113    0
#>  12 per group   0.4  0.7  0.3 0.84722 0.011504 0.14128    0
#>  18 per group   0.0  0.3  0.3 0.10072 0.430011 0.46927    0
#>  18 per group   0.1  0.4  0.3 0.27614 0.209190 0.51467    0
#>  18 per group   0.2  0.5  0.3 0.51809 0.078087 0.40382    0
#>  18 per group   0.3  0.6  0.3 0.75066 0.020935 0.22841    0
#>  18 per group   0.4  0.7  0.3 0.90834 0.003556 0.08811    0
#>  24 per group   0.0  0.3  0.3 0.07551 0.456998 0.46750    0
#>  24 per group   0.1  0.4  0.3 0.26111 0.192246 0.54664    0
#>  24 per group   0.2  0.5  0.3 0.53935 0.056720 0.40393    0
#>  24 per group   0.3  0.6  0.3 0.79565 0.010812 0.19353    0
#>  24 per group   0.4  0.7  0.3 0.94297 0.001128 0.05590    0
plot(cmp)


# Borrowing of external control data
ext <- qdm_external(des, external_c = borrow(data_binary(40, 12), 0.5))
qdm_compare(list(Concurrent = des, Borrowing = ext),
            data.frame(pi_t = c(0.3, 0.6), pi_c = 0.3))
#> Operating characteristics of 2 designs
#> Method: exact enumeration of the outcomes
#>      design pi_t pi_c      Go    NoGo   Gray Miss
#>  Concurrent  0.3  0.3 0.13165 0.41696 0.4514    0
#>  Concurrent  0.6  0.3 0.68750 0.04137 0.2711    0
#>   Borrowing  0.3  0.3 0.07869 0.45942 0.4619    0
#>   Borrowing  0.6  0.3 0.74445 0.01724 0.2383    0