Skip to contents

Creates the data frame of scenarios for the true parameters that qdm_oc, qdm_compare, qdm_calibrate and qdm_find_n use, with the columns that the design needs (see qdm_oc). Missing, unknown and repeated columns are errors.

Usage

qdm_scenarios(design, ..., theta = NULL, grid = TRUE)

Arguments

design

A design created by design_binary, design_continuous, design_binary2, design_continuous2 or design_tte, or a design specification started by qdm_endpoint, which is built by qdm_build.

...

Named numeric vectors: the values of the columns of the scenarios.

theta

NULL (the default) to give all the columns in ...; the treatment effects, a numeric vector for one endpoint or a list of two numeric vectors (the effects on endpoints 1 and 2) for two endpoints; or "thresholds".

grid

TRUE (the default) for all combinations of the values, as expand.grid() (the effects, then the values in the order given, the first varying fastest), or FALSE to combine the values row by row, each value having length 1 or the length of the longest value.

Value

A data frame with one row per scenario: the column theta (or theta1 and theta2) when theta is given, followed by the columns of the scenarios in the order given in qdm_oc.

Details

The values of the columns are given in ..., for example pi_t = seq(0.2, 0.8, by = 0.1), pi_c = 0.4 for one binary endpoint. A name without the letter of the group gives the same value to both groups: sd for a continuous endpoint (sd_t and sd_c), rho for two binary endpoints (rho_t and rho_c), and sd1, sd2 and rho for two continuous endpoints. The columns of the control group are not used for a design without a concurrent control group. The correlations of two endpoints have no default value, because the operating characteristics depend on them (for two binary endpoints, the feasible correlations also depend on the response rates; see cellprob_binary2).

Alternatively, the scenarios can be given by the treatment effect theta, on the scale of the decision criterion and of the horizontal axis of the plots of qdm_oc. The parameter of the treatment group that sets the effect (pi_t, mu_t or median_t; pi_t1 and pi_t2; or mu_t1 and mu_t2) is then computed, and is not given in .... With a concurrent control group, the effect is measured from the parameter of the control group given in ...; without one, from the fixed control value, or from the mean (binary and time-to-event endpoints) or the location (continuous endpoints) of the distribution of the control group. For a time-to-event endpoint evaluated by the milestone survival, the median survival time of the treatment group is \(M_t = -\log(2) t_0 / \log(S_c(t_0) + \theta)\), where \(S_c(t_0)\) is the milestone survival probability of the control group; for the hazard ratio \(\theta = \lambda_t / \lambda_c\), it is \(M_t = M_c / \theta\), or \(\log(2) / (\theta \lambda_c)\) without a concurrent control group, where \(\lambda_c\) is the fixed control hazard or the mean of the distribution of the control hazard.

theta = "thresholds" gives the effects that a study protocol usually reports: no effect (0, or 1 for a hazard ratio), the minimum acceptable value and the target value of the criterion (the null value of a predictive criterion), for each endpoint (repeated values are given once).

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)
)
qdm_scenarios(des, pi_t = seq(0.2, 0.8, by = 0.2), pi_c = 0.4)
#>   pi_t pi_c
#> 1  0.2  0.4
#> 2  0.4  0.4
#> 3  0.6  0.4
#> 4  0.8  0.4

# Scenarios given by the effect
qdm_scenarios(des, theta = c(0, 0.1, 0.2, 0.3), pi_c = 0.4)
#>   theta pi_t pi_c
#> 1   0.0  0.4  0.4
#> 2   0.1  0.5  0.4
#> 3   0.2  0.6  0.4
#> 4   0.3  0.7  0.4

# No effect, the minimum acceptable value and the target value
scen <- qdm_scenarios(des, theta = "thresholds", pi_c = 0.4)
qdm_oc(des, scen)
#> Operating characteristics (exact enumeration of the outcomes)
#>  theta pi_t pi_c     Go   NoGo   Gray Miss
#>    0.0  0.4  0.4 0.1485 0.4180 0.4335    0
#>    0.1  0.5  0.4 0.2981 0.2409 0.4610    0
#>    0.2  0.6  0.4 0.4891 0.1143 0.3966    0

# Two continuous endpoints with the same standard deviations and
# correlation in both groups
des2 <- design_continuous2(
  n_t = 12, n_c = 12, prior_t = prior_vague(), prior_c = prior_vague(),
  criterion = criterion_posterior(theta_tv = c(10, 2), theta_mav = c(5, 1),
                                  gamma_go = 0.5, gamma_nogo = 0.3)
)
qdm_scenarios(des2, theta = list(c(0, 5, 10), c(0, 1, 2)), mu_c1 = 0,
              mu_c2 = 0, sd1 = 20, sd2 = 4, rho = 0.3)
#>   theta1 theta2 mu_t1 mu_t2 sd_t1 sd_t2 rho_t mu_c1 mu_c2 sd_c1 sd_c2 rho_c
#> 1      0      0     0     0    20     4   0.3     0     0    20     4   0.3
#> 2      5      0     5     0    20     4   0.3     0     0    20     4   0.3
#> 3     10      0    10     0    20     4   0.3     0     0    20     4   0.3
#> 4      0      1     0     1    20     4   0.3     0     0    20     4   0.3
#> 5      5      1     5     1    20     4   0.3     0     0    20     4   0.3
#> 6     10      1    10     1    20     4   0.3     0     0    20     4   0.3
#> 7      0      2     0     2    20     4   0.3     0     0    20     4   0.3
#> 8      5      2     5     2    20     4   0.3     0     0    20     4   0.3
#> 9     10      2    10     2    20     4   0.3     0     0    20     4   0.3