knitr::opts_chunk$set(echo    = F,
                      results = "asis")

Design setting

The trial will be designed to compare an experimental treatment (arm 1) to a control (arm 0), through a group-sequential trial with at most $J$ stages. Response $X_{ijk}$, from patient $i=1,\dots,n_k$, in arm $k=0,1$, in stage $j=1,\dots,J$, will be assumed to be distributed as $X_{ijk} \sim N(\mu_k,\sigma_k^2)$. Then, the hypothesis to be tested will be: $$ H_0 : \tau = \mu_1 - \mu_0 \le 0.$$ The type-I error-rate will be desired to be at most $\alpha$, and the trial will be powered at level $1-\beta$ for the scenario where $\tau=\delta>0$ (the alternative hypothesis $H_1$).

At interim analysis $j=1,\dots,J$, a standardised test statistic $Z_j$ will be compared to efficacy and futility boundaries $e_j$ and $f_j$ respectively.

Inputs

  J            <- params$J
  alpha        <- params$alpha
  beta         <- params$beta
  delta        <- params$delta
  sigma0       <- params$sigma0
  sigma1       <- params$sigma1
  ratio        <- params$ratio
  shape        <- params$shape
  optimality   <- params$optimality
  quantile_sub <- params$quantile_sub
  integer_n    <- params$integer_n
  n0           <- params$n0
  n1           <- params$n1
  e            <- params$e
  f            <- params$f
  opchar       <- params$opchar
  plots        <- params$plots
  boundaries   <- params$boundaries
  ess          <- params$ess
  median       <- params$median
  power        <- params$power
  stopping_1   <- params$stopping_1
  stopping_2   <- params$stopping_2
if (shape == "haybittle_peto") {
  shape_text        <- "Haybittle-Peto"
} else if (shape == "near_optimal") {
  shape_text        <- "Near-optimal"
} else if (shape == "power_family") {
  shape_text        <- "Power-family"
} else if (shape == "triangular") {
  shape_text        <- "Triangular-test"
} else if (shape == "wang_tsiatis") {
  shape_text        <- "Wang-Tsiatis"
} else if (shape == "obrien_fleming") {
  shape_text        <- "O'Brien-Fleming"
} else if (shape == "pocock") {
  shape_text        <- "Pocock"
} 

if (shape == "near_optimal") {
  if (optimality == "null_optimal") {
    optimality_text <- "be to minimise the expected sample size under the null"
  } else if (optimality == "alt_optimal") {
    optimality_text <- "be to minimise the expected sample size under the alternative"
  } else if (optimality == "delta_minimax") {
    optimality_text <- "be to minimise the maximum expected sample size"
  } else if (optimality == "balanced") {
    optimality_text <- "be a balanced near-optimal design"
  }
} else {
  optimality_text <- "not be used (i.e., a non-optimised design has been chosen)"
}


if (quantile_sub) {
  quantile_sub_text <- "will"
} else {
  quantile_sub_text <- "will not"
}

if (integer_n) {
  integer_n_text    <- "will"
} else {
  integer_n_text    <- "will not"
}

if (plots) {
  plot_text         <- "will"
} else {
  plot_text         <- "will not"
}

The following choices were made:

Outputs

typeI  <- round(opchar[1, 2], 3)
typeII <- round(1 - opchar[3, 2], 3)
e_text <- paste0("(", paste(round(e, 3), collapse = ", "), ")")
f_text <- paste0("(", paste(round(f, 3), collapse = ", "), ")")
library(knitr)
min_col   <- 2
max_col   <- 5
tables    <- list()
while (max_col < ncol(params$opchar)) {
  print(kable(params$opchar[1:3, c(1, min_col:max_col)]))
  cat("\n \n \n \n \n \n")
  min_col <- max_col + 1
  max_col <- max_col + 5
}
print(kable(params$opchar[1:3, c(1, min_col:min(ncol(params$opchar),
                                                max_col))]))

Plots

print(params$boundaries)
cat("\n \n \n \n \n \n")
if (params$plots) {
  print(params$power)
  cat("\n \n \n \n \n \n")
  print(params$ess)
  cat("\n \n \n \n \n \n")
  print(params$mess)
  cat("\n \n \n \n \n \n")
  print(params$moss)
  cat("\n \n \n \n \n \n")
  print(params$sdss)
  cat("\n \n \n \n \n \n")
  print(params$stopping_1)
  cat("\n \n \n \n \n \n")
  print(params$stopping_2)
} else {
  cat("Remaining plots not chosen for output: select the box next to 'Produce plots' to add additional plots to the report.")
}
cat("\n \n \n \n \n \n")
if (all(params$estimators, params$J == 2)) {
  print(params$cond_bias_1)
  cat("\n \n \n \n \n \n")
  print(params$cond_bias_2)
  cat("\n \n \n \n \n \n")
  print(params$marg_bias)
  cat("\n \n \n \n \n \n")
  print(params$cond_rmse_1)
  cat("\n \n \n \n \n \n")
  print(params$cond_rmse_2)
  cat("\n \n \n \n \n \n")
  print(params$marg_rmse)
}


mjg211/OptGS documentation built on May 28, 2021, 3:44 p.m.