Skip to contents

Computes the optimal Go threshold \(\gamma_{\mathrm{go}}\) and NoGo threshold \(\gamma_{\mathrm{nogo}}\) for a single continuous endpoint by searching over a grid of candidate values. The two thresholds are calibrated independently under separate scenarios:

  • \(\gamma_{\mathrm{go}}\) is the smallest value in gamma_grid such that the marginal Go probability \(\Pr(g_{\mathrm{Go}} \ge \gamma_{\mathrm{go}})\) is strictly less than target_go under the Go-calibration scenario (mu_t_go, mu_c_go, sigma_t_go, sigma_c_go); typically the Null scenario.

  • \(\gamma_{\mathrm{nogo}}\) is the smallest value in gamma_grid such that the marginal NoGo probability \(\Pr(g_{\mathrm{NoGo}} \ge \gamma_{\mathrm{nogo}})\) is strictly less than target_nogo under the NoGo-calibration scenario (mu_t_nogo, mu_c_nogo, sigma_t_nogo, sigma_c_nogo); typically the Alternative scenario.

Here \(g_{\mathrm{Go}} = P(\theta > \theta_{\mathrm{TV}} \mid \bar{y}_t, s_t, \bar{y}_c, s_c)\) and \(g_{\mathrm{NoGo}} = P(\theta \le \theta_{\mathrm{MAV}} \mid \bar{y}_t, s_t, \bar{y}_c, s_c)\) for prob = 'posterior', consistent with the decision rule in pbayesdecisionprob1cont.

Usage

getgamma1cont(
  nsim,
  prob = "posterior",
  design = "controlled",
  prior = "vague",
  CalcMethod = "NI",
  theta_TV = NULL,
  theta_MAV = NULL,
  theta_NULL = NULL,
  nMC = NULL,
  mu_t_go,
  mu_c_go = NULL,
  sigma_t_go,
  sigma_c_go = NULL,
  mu_t_nogo,
  mu_c_nogo = NULL,
  sigma_t_nogo,
  sigma_c_nogo = NULL,
  target_go,
  target_nogo,
  n_t,
  n_c = NULL,
  m_t = NULL,
  m_c = NULL,
  kappa0_t = NULL,
  kappa0_c = NULL,
  nu0_t = NULL,
  nu0_c = NULL,
  mu0_t = NULL,
  mu0_c = NULL,
  sigma0_t = NULL,
  sigma0_c = NULL,
  r = NULL,
  ne_t = NULL,
  ne_c = NULL,
  alpha0e_t = NULL,
  alpha0e_c = NULL,
  bar_ye_t = NULL,
  bar_ye_c = NULL,
  se_t = NULL,
  se_c = NULL,
  gamma_grid = seq(0.01, 0.99, by = 0.01),
  seed
)

Arguments

nsim

A positive integer giving the number of Monte Carlo simulation replicates used to approximate the operating characteristics.

prob

A character string specifying the probability type. Must be 'posterior' or 'predictive'.

design

A character string specifying the trial design. Must be 'controlled', 'uncontrolled', or 'external'.

prior

A character string specifying the prior distribution. Must be 'vague' or 'N-Inv-Chisq'.

CalcMethod

A character string specifying the computation method for pbayespostpred1cont. Must be 'NI', 'MC', or 'MM'.

theta_TV

A numeric scalar giving the Target Value (TV) threshold for the treatment effect. Required when prob = 'posterior'; set to NULL otherwise.

theta_MAV

A numeric scalar giving the Minimum Acceptable Value (MAV) threshold. Must satisfy theta_TV > theta_MAV. Required when prob = 'posterior'; set to NULL otherwise.

theta_NULL

A numeric scalar giving the null hypothesis threshold for the predictive probability. Required when prob = 'predictive'; set to NULL otherwise.

nMC

A positive integer giving the number of inner Monte Carlo draws passed to pbayespostpred1cont. Required when CalcMethod = 'MC'; set to NULL otherwise.

mu_t_go

A numeric scalar giving the true mean for the treatment group under the Go-calibration scenario (typically Null).

mu_c_go

A numeric scalar giving the true mean for the control group under the Go-calibration scenario. Set to NULL for design = 'uncontrolled'.

sigma_t_go

A positive numeric scalar giving the true standard deviation for the treatment group under the Go-calibration scenario.

sigma_c_go

A positive numeric scalar giving the true standard deviation for the control group under the Go-calibration scenario. Set to NULL for design = 'uncontrolled'.

mu_t_nogo

A numeric scalar giving the true mean for the treatment group under the NoGo-calibration scenario (typically Alternative).

mu_c_nogo

A numeric scalar giving the true mean for the control group under the NoGo-calibration scenario. Set to NULL for design = 'uncontrolled'.

sigma_t_nogo

A positive numeric scalar giving the true standard deviation for the treatment group under the NoGo-calibration scenario.

sigma_c_nogo

A positive numeric scalar giving the true standard deviation for the control group under the NoGo-calibration scenario. Set to NULL for design = 'uncontrolled'.

target_go

A numeric scalar in (0, 1) giving the upper bound on the marginal Go probability under the Go-calibration scenario. The optimal \(\gamma_{\mathrm{go}}\) is the smallest grid value satisfying \(\Pr(\mathrm{Go}) < \code{target\_go}\).

target_nogo

A numeric scalar in (0, 1) giving the upper bound on the marginal NoGo probability under the NoGo-calibration scenario. The optimal \(\gamma_{\mathrm{nogo}}\) is the smallest grid value satisfying \(\Pr(\mathrm{NoGo}) < \code{target\_nogo}\).

n_t

A positive integer giving the number of patients in the treatment group in the PoC trial.

n_c

A positive integer giving the number of patients in the control group in the PoC trial. Required for design = 'controlled' or 'external'; set to NULL for design = 'uncontrolled'.

m_t

A positive integer giving the future sample size for the treatment group. Required when prob = 'predictive'; set to NULL otherwise.

m_c

A positive integer giving the future sample size for the control group. Required when prob = 'predictive'; set to NULL otherwise.

kappa0_t

A positive numeric scalar giving the prior precision parameter for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

kappa0_c

A positive numeric scalar giving the prior precision parameter for the control group. Required when prior = 'N-Inv-Chisq' and design != 'uncontrolled'; set to NULL otherwise.

nu0_t

A positive numeric scalar giving the prior degrees of freedom for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

nu0_c

A positive numeric scalar giving the prior degrees of freedom for the control group. Required when prior = 'N-Inv-Chisq' and design != 'uncontrolled'; set to NULL otherwise.

mu0_t

A numeric scalar giving the prior mean for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

mu0_c

A numeric scalar giving the prior mean for the control group (or the fixed hypothetical control mean for uncontrolled design). Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

sigma0_t

A positive numeric scalar giving the prior scale parameter for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

sigma0_c

A positive numeric scalar giving the prior scale parameter for the control group. Required when prior = 'N-Inv-Chisq' and design != 'uncontrolled'; set to NULL otherwise.

r

A positive numeric scalar giving the variance ratio \(\sigma_c^2 / \sigma_t^2\) used for uncontrolled design. Required when design = 'uncontrolled'; set to NULL otherwise.

ne_t

A positive integer giving the number of patients in the treatment group of the external data set. Required when design = 'external' and external treatment data are available; otherwise set to NULL.

ne_c

A positive integer giving the number of patients in the control group of the external data set. Required when design = 'external' and external control data are available; otherwise set to NULL.

alpha0e_t

A numeric scalar in (0, 1] giving the power prior weight for external treatment group data. Required when design = 'external' and ne_t is non-NULL; set to NULL otherwise.

alpha0e_c

A numeric scalar in (0, 1] giving the power prior weight for external control group data. Required when design = 'external' and ne_c is non-NULL; set to NULL otherwise.

bar_ye_t

A numeric scalar giving the sample mean of the external treatment group data. Required when ne_t is non-NULL; set to NULL otherwise.

bar_ye_c

A numeric scalar giving the sample mean of the external control group data. Required when ne_c is non-NULL; set to NULL otherwise.

se_t

A positive numeric scalar giving the sample standard deviation of the external treatment group data. Required when ne_t is non-NULL; set to NULL otherwise.

se_c

A positive numeric scalar giving the sample standard deviation of the external control group data. Required when ne_c is non-NULL; set to NULL otherwise.

gamma_grid

A numeric vector of candidate threshold values in (0, 1) to search over. Defaults to seq(0.01, 0.99, by = 0.01).

seed

A numeric scalar for reproducible random number generation. The Go-calibration simulation uses seed and the NoGo-calibration simulation uses seed + 1 to ensure independence between the two scenarios.

Value

A list of class getgamma1cont with the following elements:

gamma_go

Optimal Go threshold: the smallest value in gamma_grid for which \(\Pr(\mathrm{Go}) < \code{target\_go}\) under the Go-calibration scenario. NA if no such value exists.

gamma_nogo

Optimal NoGo threshold: the smallest value in gamma_grid for which \(\Pr(\mathrm{NoGo}) < \code{target\_nogo}\) under the NoGo-calibration scenario. NA if no such value exists.

PrGo_opt

Marginal \(\Pr(g_{\mathrm{Go}} \ge \gamma_{\mathrm{go}})\) at the optimal \(\gamma_{\mathrm{go}}\) under the Go-calibration scenario. NA if gamma_go is NA.

PrNoGo_opt

Marginal \(\Pr(g_{\mathrm{NoGo}} \ge \gamma_{\mathrm{nogo}})\) at the optimal \(\gamma_{\mathrm{nogo}}\) under the NoGo-calibration scenario. NA if gamma_nogo is NA.

target_go

The value of target_go supplied by the user.

target_nogo

The value of target_nogo supplied by the user.

grid_results

A data frame with columns gamma_grid, PrGo_grid (marginal Go probability under the Go-calibration scenario), and PrNoGo_grid (marginal NoGo probability under the NoGo-calibration scenario).

Details

The function uses a two-stage simulate-then-sweep strategy:

  1. Simulation: nsim datasets are generated independently for each calibration scenario. For the Go-calibration scenario, standardised residuals are shifted by mu_t_go and mu_c_go; for the NoGo-calibration scenario, by mu_t_nogo and mu_c_nogo. pbayespostpred1cont is called once per scenario to obtain \(g_{\mathrm{Go}}\) (lower.tail = FALSE at theta_TV) and \(g_{\mathrm{NoGo}}\) (lower.tail = TRUE at theta_MAV).

  2. Gamma sweep: Marginal probabilities are estimated as the proportion of simulated datasets satisfying the respective indicator: \(g_{\mathrm{Go}} \ge \gamma\) for PrGo_grid, and \(g_{\mathrm{NoGo}} \ge \gamma\) for PrNoGo_grid. Both are monotone non-increasing in \(\gamma\).

The optimal \(\gamma_{\mathrm{go}}\) and \(\gamma_{\mathrm{nogo}}\) are each the smallest grid value crossing below the respective target probability.

Examples

# Example 1: Controlled design, vague prior, posterior probability
# gamma_go  : smallest gamma s.t. Pr(Go)   < 0.05 under Null (mu_t = mu_c = 1.0)
# gamma_nogo: smallest gamma s.t. Pr(NoGo) < 0.20 under Alt  (mu_t = 2.5, mu_c = 1.0)
getgamma1cont(
  nsim = 1000L, prob = 'posterior', design = 'controlled',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = 1.5, theta_MAV = 0.0, theta_NULL = NULL, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 2.0, sigma_c_go = 2.0,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 2.0, sigma_c_nogo = 2.0,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, m_t = NULL, m_c = NULL,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  r = NULL, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 1L
)
#> $gamma_go
#> [1] 0.34
#> 
#> $gamma_nogo
#> [1] 0.13
#> 
#> $PrGo_opt
#> [1] 0.049
#> 
#> $PrNoGo_opt
#> [1] 0.191
#> 
#> $target_go
#> [1] 0.05
#> 
#> $target_nogo
#> [1] 0.2
#> 
#> $grid_results
#>    gamma_grid PrGo_grid PrNoGo_grid
#> 1        0.01     0.664       0.692
#> 2        0.02     0.546       0.579
#> 3        0.03     0.468       0.492
#> 4        0.04     0.407       0.440
#> 5        0.05     0.364       0.395
#> 6        0.06     0.332       0.354
#> 7        0.07     0.296       0.321
#> 8        0.08     0.274       0.293
#> 9        0.09     0.247       0.263
#> 10       0.10     0.228       0.236
#> 11       0.11     0.213       0.218
#> 12       0.12     0.198       0.206
#> 13       0.13     0.179       0.191
#> 14       0.14     0.169       0.175
#> 15       0.15     0.160       0.164
#> 16       0.16     0.145       0.154
#> 17       0.17     0.134       0.143
#> 18       0.18     0.126       0.132
#> 19       0.19     0.116       0.126
#> 20       0.20     0.106       0.121
#> 21       0.21     0.099       0.113
#> 22       0.22     0.092       0.107
#> 23       0.23     0.084       0.094
#> 24       0.24     0.078       0.087
#> 25       0.25     0.076       0.084
#> 26       0.26     0.072       0.079
#> 27       0.27     0.067       0.076
#> 28       0.28     0.065       0.074
#> 29       0.29     0.063       0.066
#> 30       0.30     0.056       0.060
#> 31       0.31     0.056       0.057
#> 32       0.32     0.051       0.053
#> 33       0.33     0.051       0.049
#> 34       0.34     0.049       0.046
#> 35       0.35     0.047       0.046
#> 36       0.36     0.044       0.044
#> 37       0.37     0.040       0.040
#> 38       0.38     0.035       0.038
#> 39       0.39     0.032       0.034
#> 40       0.40     0.032       0.033
#> 41       0.41     0.032       0.032
#> 42       0.42     0.030       0.030
#> 43       0.43     0.028       0.028
#> 44       0.44     0.026       0.028
#> 45       0.45     0.026       0.027
#> 46       0.46     0.025       0.026
#> 47       0.47     0.023       0.024
#> 48       0.48     0.023       0.021
#> 49       0.49     0.023       0.019
#> 50       0.50     0.022       0.017
#> 51       0.51     0.021       0.016
#> 52       0.52     0.020       0.015
#> 53       0.53     0.018       0.015
#> 54       0.54     0.015       0.015
#> 55       0.55     0.012       0.014
#> 56       0.56     0.010       0.013
#> 57       0.57     0.010       0.012
#> 58       0.58     0.009       0.011
#> 59       0.59     0.009       0.011
#> 60       0.60     0.009       0.011
#> 61       0.61     0.008       0.011
#> 62       0.62     0.007       0.010
#> 63       0.63     0.007       0.009
#> 64       0.64     0.006       0.007
#> 65       0.65     0.005       0.006
#> 66       0.66     0.004       0.006
#> 67       0.67     0.004       0.006
#> 68       0.68     0.003       0.005
#> 69       0.69     0.003       0.004
#> 70       0.70     0.003       0.002
#> 71       0.71     0.003       0.002
#> 72       0.72     0.003       0.002
#> 73       0.73     0.003       0.002
#> 74       0.74     0.002       0.002
#> 75       0.75     0.002       0.002
#> 76       0.76     0.002       0.002
#> 77       0.77     0.002       0.001
#> 78       0.78     0.002       0.001
#> 79       0.79     0.002       0.001
#> 80       0.80     0.002       0.001
#> 81       0.81     0.002       0.001
#> 82       0.82     0.002       0.001
#> 83       0.83     0.001       0.001
#> 84       0.84     0.001       0.001
#> 85       0.85     0.001       0.001
#> 86       0.86     0.001       0.001
#> 87       0.87     0.000       0.001
#> 88       0.88     0.000       0.001
#> 89       0.89     0.000       0.001
#> 90       0.90     0.000       0.000
#> 91       0.91     0.000       0.000
#> 92       0.92     0.000       0.000
#> 93       0.93     0.000       0.000
#> 94       0.94     0.000       0.000
#> 95       0.95     0.000       0.000
#> 96       0.96     0.000       0.000
#> 97       0.97     0.000       0.000
#> 98       0.98     0.000       0.000
#> 99       0.99     0.000       0.000
#> 
#> attr(,"class")
#> [1] "getgamma1cont"

# Example 2: Uncontrolled design, N-Inv-Chisq prior, posterior probability
getgamma1cont(
  nsim = 1000L, prob = 'posterior', design = 'uncontrolled',
  prior = 'N-Inv-Chisq', CalcMethod = 'NI',
  theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL, nMC = NULL,
  mu_t_go = 1.5, mu_c_go = NULL, sigma_t_go = 1.5, sigma_c_go = NULL,
  mu_t_nogo = 3.0, mu_c_nogo = NULL, sigma_t_nogo = 1.5, sigma_c_nogo = NULL,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 20L, n_c = NULL, m_t = NULL, m_c = NULL,
  kappa0_t = 2, kappa0_c = NULL, nu0_t = 5, nu0_c = NULL,
  mu0_t = 3.0, mu0_c = 1.5, sigma0_t = 1.5, sigma0_c = NULL,
  r = 1.0, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 2L
)
#> $gamma_go
#> [1] 0.24
#> 
#> $gamma_nogo
#> [1] 0.01
#> 
#> $PrGo_opt
#> [1] 0.048
#> 
#> $PrNoGo_opt
#> [1] 0.136
#> 
#> $target_go
#> [1] 0.05
#> 
#> $target_nogo
#> [1] 0.2
#> 
#> $grid_results
#>    gamma_grid PrGo_grid PrNoGo_grid
#> 1        0.01     0.801       0.136
#> 2        0.02     0.653       0.056
#> 3        0.03     0.544       0.030
#> 4        0.04     0.459       0.014
#> 5        0.05     0.394       0.010
#> 6        0.06     0.337       0.007
#> 7        0.07     0.292       0.002
#> 8        0.08     0.253       0.001
#> 9        0.09     0.230       0.000
#> 10       0.10     0.199       0.000
#> 11       0.11     0.184       0.000
#> 12       0.12     0.165       0.000
#> 13       0.13     0.141       0.000
#> 14       0.14     0.127       0.000
#> 15       0.15     0.116       0.000
#> 16       0.16     0.107       0.000
#> 17       0.17     0.101       0.000
#> 18       0.18     0.095       0.000
#> 19       0.19     0.087       0.000
#> 20       0.20     0.070       0.000
#> 21       0.21     0.065       0.000
#> 22       0.22     0.061       0.000
#> 23       0.23     0.055       0.000
#> 24       0.24     0.048       0.000
#> 25       0.25     0.044       0.000
#> 26       0.26     0.040       0.000
#> 27       0.27     0.038       0.000
#> 28       0.28     0.034       0.000
#> 29       0.29     0.030       0.000
#> 30       0.30     0.027       0.000
#> 31       0.31     0.025       0.000
#> 32       0.32     0.022       0.000
#> 33       0.33     0.021       0.000
#> 34       0.34     0.020       0.000
#> 35       0.35     0.018       0.000
#> 36       0.36     0.017       0.000
#> 37       0.37     0.015       0.000
#> 38       0.38     0.015       0.000
#> 39       0.39     0.014       0.000
#> 40       0.40     0.009       0.000
#> 41       0.41     0.009       0.000
#> 42       0.42     0.006       0.000
#> 43       0.43     0.005       0.000
#> 44       0.44     0.004       0.000
#> 45       0.45     0.004       0.000
#> 46       0.46     0.003       0.000
#> 47       0.47     0.002       0.000
#> 48       0.48     0.001       0.000
#> 49       0.49     0.001       0.000
#> 50       0.50     0.001       0.000
#> 51       0.51     0.001       0.000
#> 52       0.52     0.001       0.000
#> 53       0.53     0.001       0.000
#> 54       0.54     0.001       0.000
#> 55       0.55     0.001       0.000
#> 56       0.56     0.001       0.000
#> 57       0.57     0.001       0.000
#> 58       0.58     0.001       0.000
#> 59       0.59     0.001       0.000
#> 60       0.60     0.001       0.000
#> 61       0.61     0.000       0.000
#> 62       0.62     0.000       0.000
#> 63       0.63     0.000       0.000
#> 64       0.64     0.000       0.000
#> 65       0.65     0.000       0.000
#> 66       0.66     0.000       0.000
#> 67       0.67     0.000       0.000
#> 68       0.68     0.000       0.000
#> 69       0.69     0.000       0.000
#> 70       0.70     0.000       0.000
#> 71       0.71     0.000       0.000
#> 72       0.72     0.000       0.000
#> 73       0.73     0.000       0.000
#> 74       0.74     0.000       0.000
#> 75       0.75     0.000       0.000
#> 76       0.76     0.000       0.000
#> 77       0.77     0.000       0.000
#> 78       0.78     0.000       0.000
#> 79       0.79     0.000       0.000
#> 80       0.80     0.000       0.000
#> 81       0.81     0.000       0.000
#> 82       0.82     0.000       0.000
#> 83       0.83     0.000       0.000
#> 84       0.84     0.000       0.000
#> 85       0.85     0.000       0.000
#> 86       0.86     0.000       0.000
#> 87       0.87     0.000       0.000
#> 88       0.88     0.000       0.000
#> 89       0.89     0.000       0.000
#> 90       0.90     0.000       0.000
#> 91       0.91     0.000       0.000
#> 92       0.92     0.000       0.000
#> 93       0.93     0.000       0.000
#> 94       0.94     0.000       0.000
#> 95       0.95     0.000       0.000
#> 96       0.96     0.000       0.000
#> 97       0.97     0.000       0.000
#> 98       0.98     0.000       0.000
#> 99       0.99     0.000       0.000
#> 
#> attr(,"class")
#> [1] "getgamma1cont"

# Example 3: External design, vague prior, posterior probability
getgamma1cont(
  nsim = 1000L, prob = 'posterior', design = 'external',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 1.5, sigma_c_go = 1.5,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 1.5, sigma_c_nogo = 1.5,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, m_t = NULL, m_c = NULL,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  r = NULL, ne_t = NULL, ne_c = 20L, alpha0e_t = NULL, alpha0e_c = 0.5,
  bar_ye_t = NULL, bar_ye_c = 0.0, se_t = NULL, se_c = 1.5,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 4L
)
#> $gamma_go
#> [1] 0.6
#> 
#> $gamma_nogo
#> [1] 0.01
#> 
#> $PrGo_opt
#> [1] 0.049
#> 
#> $PrNoGo_opt
#> [1] 0.098
#> 
#> $target_go
#> [1] 0.05
#> 
#> $target_nogo
#> [1] 0.2
#> 
#> $grid_results
#>    gamma_grid PrGo_grid PrNoGo_grid
#> 1        0.01     0.915       0.098
#> 2        0.02     0.853       0.050
#> 3        0.03     0.792       0.028
#> 4        0.04     0.741       0.018
#> 5        0.05     0.706       0.016
#> 6        0.06     0.664       0.010
#> 7        0.07     0.632       0.008
#> 8        0.08     0.600       0.004
#> 9        0.09     0.575       0.003
#> 10       0.10     0.543       0.003
#> 11       0.11     0.508       0.003
#> 12       0.12     0.489       0.001
#> 13       0.13     0.466       0.001
#> 14       0.14     0.442       0.000
#> 15       0.15     0.429       0.000
#> 16       0.16     0.415       0.000
#> 17       0.17     0.391       0.000
#> 18       0.18     0.372       0.000
#> 19       0.19     0.354       0.000
#> 20       0.20     0.339       0.000
#> 21       0.21     0.325       0.000
#> 22       0.22     0.307       0.000
#> 23       0.23     0.289       0.000
#> 24       0.24     0.279       0.000
#> 25       0.25     0.267       0.000
#> 26       0.26     0.249       0.000
#> 27       0.27     0.241       0.000
#> 28       0.28     0.227       0.000
#> 29       0.29     0.215       0.000
#> 30       0.30     0.206       0.000
#> 31       0.31     0.203       0.000
#> 32       0.32     0.198       0.000
#> 33       0.33     0.184       0.000
#> 34       0.34     0.175       0.000
#> 35       0.35     0.165       0.000
#> 36       0.36     0.161       0.000
#> 37       0.37     0.156       0.000
#> 38       0.38     0.151       0.000
#> 39       0.39     0.144       0.000
#> 40       0.40     0.135       0.000
#> 41       0.41     0.131       0.000
#> 42       0.42     0.128       0.000
#> 43       0.43     0.122       0.000
#> 44       0.44     0.117       0.000
#> 45       0.45     0.111       0.000
#> 46       0.46     0.105       0.000
#> 47       0.47     0.101       0.000
#> 48       0.48     0.098       0.000
#> 49       0.49     0.088       0.000
#> 50       0.50     0.081       0.000
#> 51       0.51     0.076       0.000
#> 52       0.52     0.071       0.000
#> 53       0.53     0.068       0.000
#> 54       0.54     0.065       0.000
#> 55       0.55     0.061       0.000
#> 56       0.56     0.058       0.000
#> 57       0.57     0.057       0.000
#> 58       0.58     0.055       0.000
#> 59       0.59     0.052       0.000
#> 60       0.60     0.049       0.000
#> 61       0.61     0.046       0.000
#> 62       0.62     0.043       0.000
#> 63       0.63     0.039       0.000
#> 64       0.64     0.039       0.000
#> 65       0.65     0.037       0.000
#> 66       0.66     0.034       0.000
#> 67       0.67     0.032       0.000
#> 68       0.68     0.031       0.000
#> 69       0.69     0.029       0.000
#> 70       0.70     0.029       0.000
#> 71       0.71     0.026       0.000
#> 72       0.72     0.026       0.000
#> 73       0.73     0.026       0.000
#> 74       0.74     0.026       0.000
#> 75       0.75     0.022       0.000
#> 76       0.76     0.021       0.000
#> 77       0.77     0.018       0.000
#> 78       0.78     0.017       0.000
#> 79       0.79     0.017       0.000
#> 80       0.80     0.015       0.000
#> 81       0.81     0.013       0.000
#> 82       0.82     0.013       0.000
#> 83       0.83     0.010       0.000
#> 84       0.84     0.010       0.000
#> 85       0.85     0.010       0.000
#> 86       0.86     0.008       0.000
#> 87       0.87     0.008       0.000
#> 88       0.88     0.008       0.000
#> 89       0.89     0.006       0.000
#> 90       0.90     0.006       0.000
#> 91       0.91     0.006       0.000
#> 92       0.92     0.005       0.000
#> 93       0.93     0.004       0.000
#> 94       0.94     0.003       0.000
#> 95       0.95     0.002       0.000
#> 96       0.96     0.001       0.000
#> 97       0.97     0.001       0.000
#> 98       0.98     0.001       0.000
#> 99       0.99     0.001       0.000
#> 
#> attr(,"class")
#> [1] "getgamma1cont"

# Example 4: Controlled design, vague prior, predictive probability
getgamma1cont(
  nsim = 1000L, prob = 'predictive', design = 'controlled',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 2.0, sigma_c_go = 2.0,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 2.0, sigma_c_nogo = 2.0,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, m_t = 50L, m_c = 50L,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  r = NULL, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 3L
)
#> $gamma_go
#> [1] 0.64
#> 
#> $gamma_nogo
#> [1] 0.63
#> 
#> $PrGo_opt
#> [1] 0.048
#> 
#> $PrNoGo_opt
#> [1] 0.197
#> 
#> $target_go
#> [1] 0.05
#> 
#> $target_nogo
#> [1] 0.2
#> 
#> $grid_results
#>    gamma_grid PrGo_grid PrNoGo_grid
#> 1        0.01     0.535       0.786
#> 2        0.02     0.451       0.730
#> 3        0.03     0.417       0.695
#> 4        0.04     0.391       0.669
#> 5        0.05     0.364       0.637
#> 6        0.06     0.335       0.617
#> 7        0.07     0.317       0.590
#> 8        0.08     0.300       0.568
#> 9        0.09     0.288       0.551
#> 10       0.10     0.279       0.532
#> 11       0.11     0.270       0.523
#> 12       0.12     0.261       0.514
#> 13       0.13     0.251       0.500
#> 14       0.14     0.240       0.492
#> 15       0.15     0.230       0.487
#> 16       0.16     0.221       0.474
#> 17       0.17     0.216       0.463
#> 18       0.18     0.208       0.458
#> 19       0.19     0.198       0.450
#> 20       0.20     0.193       0.441
#> 21       0.21     0.183       0.434
#> 22       0.22     0.177       0.430
#> 23       0.23     0.175       0.425
#> 24       0.24     0.173       0.410
#> 25       0.25     0.167       0.405
#> 26       0.26     0.162       0.396
#> 27       0.27     0.157       0.389
#> 28       0.28     0.151       0.382
#> 29       0.29     0.148       0.374
#> 30       0.30     0.142       0.362
#> 31       0.31     0.138       0.358
#> 32       0.32     0.135       0.347
#> 33       0.33     0.130       0.342
#> 34       0.34     0.127       0.333
#> 35       0.35     0.126       0.329
#> 36       0.36     0.119       0.327
#> 37       0.37     0.116       0.322
#> 38       0.38     0.110       0.314
#> 39       0.39     0.109       0.309
#> 40       0.40     0.107       0.306
#> 41       0.41     0.105       0.302
#> 42       0.42     0.103       0.295
#> 43       0.43     0.096       0.289
#> 44       0.44     0.091       0.286
#> 45       0.45     0.089       0.281
#> 46       0.46     0.087       0.276
#> 47       0.47     0.086       0.272
#> 48       0.48     0.085       0.265
#> 49       0.49     0.081       0.255
#> 50       0.50     0.077       0.250
#> 51       0.51     0.076       0.244
#> 52       0.52     0.072       0.241
#> 53       0.53     0.069       0.235
#> 54       0.54     0.067       0.229
#> 55       0.55     0.062       0.227
#> 56       0.56     0.060       0.220
#> 57       0.57     0.059       0.216
#> 58       0.58     0.057       0.209
#> 59       0.59     0.055       0.207
#> 60       0.60     0.054       0.205
#> 61       0.61     0.054       0.203
#> 62       0.62     0.053       0.201
#> 63       0.63     0.051       0.197
#> 64       0.64     0.048       0.193
#> 65       0.65     0.048       0.191
#> 66       0.66     0.043       0.182
#> 67       0.67     0.040       0.179
#> 68       0.68     0.039       0.172
#> 69       0.69     0.039       0.167
#> 70       0.70     0.038       0.160
#> 71       0.71     0.038       0.158
#> 72       0.72     0.037       0.152
#> 73       0.73     0.034       0.148
#> 74       0.74     0.033       0.145
#> 75       0.75     0.032       0.144
#> 76       0.76     0.029       0.140
#> 77       0.77     0.029       0.132
#> 78       0.78     0.026       0.126
#> 79       0.79     0.025       0.119
#> 80       0.80     0.025       0.116
#> 81       0.81     0.022       0.111
#> 82       0.82     0.019       0.106
#> 83       0.83     0.017       0.103
#> 84       0.84     0.017       0.096
#> 85       0.85     0.017       0.094
#> 86       0.86     0.015       0.091
#> 87       0.87     0.015       0.086
#> 88       0.88     0.012       0.083
#> 89       0.89     0.011       0.076
#> 90       0.90     0.009       0.072
#> 91       0.91     0.008       0.067
#> 92       0.92     0.005       0.058
#> 93       0.93     0.003       0.052
#> 94       0.94     0.003       0.047
#> 95       0.95     0.002       0.043
#> 96       0.96     0.002       0.034
#> 97       0.97     0.001       0.028
#> 98       0.98     0.001       0.021
#> 99       0.99     0.000       0.016
#> 
#> attr(,"class")
#> [1] "getgamma1cont"

# Example 5: Uncontrolled design, vague prior, predictive probability
getgamma1cont(
  nsim = 1000L, prob = 'predictive', design = 'uncontrolled',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = NULL, sigma_t_go = 2.0, sigma_c_go = NULL,
  mu_t_nogo = 2.5, mu_c_nogo = NULL, sigma_t_nogo = 2.0, sigma_c_nogo = NULL,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = NULL, m_t = 50L, m_c = 50L,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = 0.0, sigma0_t = NULL, sigma0_c = NULL,
  r = 1.0, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 5L
)
#> $gamma_go
#> [1] 0.98
#> 
#> $gamma_nogo
#> [1] 0.02
#> 
#> $PrGo_opt
#> [1] 0.044
#> 
#> $PrNoGo_opt
#> [1] 0.136
#> 
#> $target_go
#> [1] 0.05
#> 
#> $target_nogo
#> [1] 0.2
#> 
#> $grid_results
#>    gamma_grid PrGo_grid PrNoGo_grid
#> 1        0.01     0.971       0.205
#> 2        0.02     0.954       0.136
#> 3        0.03     0.942       0.113
#> 4        0.04     0.927       0.092
#> 5        0.05     0.910       0.067
#> 6        0.06     0.898       0.058
#> 7        0.07     0.878       0.049
#> 8        0.08     0.862       0.039
#> 9        0.09     0.847       0.035
#> 10       0.10     0.833       0.032
#> 11       0.11     0.823       0.029
#> 12       0.12     0.812       0.025
#> 13       0.13     0.805       0.020
#> 14       0.14     0.798       0.019
#> 15       0.15     0.793       0.017
#> 16       0.16     0.780       0.017
#> 17       0.17     0.773       0.016
#> 18       0.18     0.764       0.013
#> 19       0.19     0.751       0.013
#> 20       0.20     0.742       0.011
#> 21       0.21     0.733       0.009
#> 22       0.22     0.728       0.008
#> 23       0.23     0.717       0.005
#> 24       0.24     0.709       0.004
#> 25       0.25     0.702       0.004
#> 26       0.26     0.686       0.004
#> 27       0.27     0.672       0.004
#> 28       0.28     0.664       0.004
#> 29       0.29     0.655       0.004
#> 30       0.30     0.653       0.004
#> 31       0.31     0.646       0.004
#> 32       0.32     0.636       0.004
#> 33       0.33     0.629       0.004
#> 34       0.34     0.619       0.004
#> 35       0.35     0.611       0.004
#> 36       0.36     0.604       0.004
#> 37       0.37     0.594       0.003
#> 38       0.38     0.587       0.003
#> 39       0.39     0.578       0.003
#> 40       0.40     0.573       0.003
#> 41       0.41     0.568       0.003
#> 42       0.42     0.562       0.003
#> 43       0.43     0.559       0.003
#> 44       0.44     0.550       0.002
#> 45       0.45     0.540       0.002
#> 46       0.46     0.532       0.002
#> 47       0.47     0.524       0.002
#> 48       0.48     0.518       0.002
#> 49       0.49     0.511       0.002
#> 50       0.50     0.502       0.002
#> 51       0.51     0.493       0.002
#> 52       0.52     0.484       0.002
#> 53       0.53     0.473       0.002
#> 54       0.54     0.468       0.002
#> 55       0.55     0.462       0.002
#> 56       0.56     0.453       0.002
#> 57       0.57     0.451       0.002
#> 58       0.58     0.437       0.002
#> 59       0.59     0.425       0.002
#> 60       0.60     0.415       0.002
#> 61       0.61     0.412       0.002
#> 62       0.62     0.404       0.002
#> 63       0.63     0.395       0.001
#> 64       0.64     0.386       0.001
#> 65       0.65     0.379       0.001
#> 66       0.66     0.370       0.001
#> 67       0.67     0.363       0.001
#> 68       0.68     0.357       0.001
#> 69       0.69     0.350       0.001
#> 70       0.70     0.333       0.001
#> 71       0.71     0.330       0.001
#> 72       0.72     0.321       0.001
#> 73       0.73     0.314       0.001
#> 74       0.74     0.303       0.001
#> 75       0.75     0.291       0.001
#> 76       0.76     0.279       0.001
#> 77       0.77     0.273       0.001
#> 78       0.78     0.261       0.001
#> 79       0.79     0.255       0.001
#> 80       0.80     0.249       0.001
#> 81       0.81     0.240       0.001
#> 82       0.82     0.226       0.001
#> 83       0.83     0.217       0.001
#> 84       0.84     0.209       0.001
#> 85       0.85     0.201       0.001
#> 86       0.86     0.189       0.001
#> 87       0.87     0.169       0.001
#> 88       0.88     0.163       0.000
#> 89       0.89     0.151       0.000
#> 90       0.90     0.140       0.000
#> 91       0.91     0.130       0.000
#> 92       0.92     0.118       0.000
#> 93       0.93     0.109       0.000
#> 94       0.94     0.099       0.000
#> 95       0.95     0.087       0.000
#> 96       0.96     0.076       0.000
#> 97       0.97     0.065       0.000
#> 98       0.98     0.044       0.000
#> 99       0.99     0.024       0.000
#> 
#> attr(,"class")
#> [1] "getgamma1cont"

# Example 6: External design, vague prior, predictive probability
getgamma1cont(
  nsim = 1000L, prob = 'predictive', design = 'external',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 1.5, sigma_c_go = 1.5,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 1.5, sigma_c_nogo = 1.5,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, m_t = 50L, m_c = 50L,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  r = NULL, ne_t = NULL, ne_c = 20L, alpha0e_t = NULL, alpha0e_c = 0.5,
  bar_ye_t = NULL, bar_ye_c = 0.0, se_t = NULL, se_c = 1.5,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 6L
)
#> $gamma_go
#> [1] 0.73
#> 
#> $gamma_nogo
#> [1] 0.06
#> 
#> $PrGo_opt
#> [1] 0.049
#> 
#> $PrNoGo_opt
#> [1] 0.188
#> 
#> $target_go
#> [1] 0.05
#> 
#> $target_nogo
#> [1] 0.2
#> 
#> $grid_results
#>    gamma_grid PrGo_grid PrNoGo_grid
#> 1        0.01     0.667       0.395
#> 2        0.02     0.593       0.310
#> 3        0.03     0.530       0.261
#> 4        0.04     0.496       0.236
#> 5        0.05     0.462       0.212
#> 6        0.06     0.445       0.188
#> 7        0.07     0.417       0.161
#> 8        0.08     0.391       0.152
#> 9        0.09     0.374       0.139
#> 10       0.10     0.355       0.132
#> 11       0.11     0.341       0.128
#> 12       0.12     0.322       0.122
#> 13       0.13     0.307       0.112
#> 14       0.14     0.299       0.104
#> 15       0.15     0.288       0.101
#> 16       0.16     0.280       0.100
#> 17       0.17     0.268       0.096
#> 18       0.18     0.260       0.092
#> 19       0.19     0.253       0.087
#> 20       0.20     0.239       0.082
#> 21       0.21     0.231       0.081
#> 22       0.22     0.226       0.074
#> 23       0.23     0.217       0.072
#> 24       0.24     0.211       0.066
#> 25       0.25     0.204       0.062
#> 26       0.26     0.197       0.059
#> 27       0.27     0.192       0.057
#> 28       0.28     0.187       0.057
#> 29       0.29     0.179       0.055
#> 30       0.30     0.175       0.052
#> 31       0.31     0.170       0.051
#> 32       0.32     0.166       0.050
#> 33       0.33     0.162       0.047
#> 34       0.34     0.158       0.046
#> 35       0.35     0.154       0.041
#> 36       0.36     0.150       0.039
#> 37       0.37     0.147       0.039
#> 38       0.38     0.145       0.038
#> 39       0.39     0.136       0.037
#> 40       0.40     0.131       0.037
#> 41       0.41     0.129       0.034
#> 42       0.42     0.128       0.033
#> 43       0.43     0.125       0.032
#> 44       0.44     0.123       0.030
#> 45       0.45     0.121       0.030
#> 46       0.46     0.118       0.030
#> 47       0.47     0.111       0.028
#> 48       0.48     0.107       0.025
#> 49       0.49     0.103       0.023
#> 50       0.50     0.102       0.023
#> 51       0.51     0.099       0.020
#> 52       0.52     0.099       0.017
#> 53       0.53     0.095       0.017
#> 54       0.54     0.093       0.017
#> 55       0.55     0.092       0.016
#> 56       0.56     0.090       0.015
#> 57       0.57     0.088       0.015
#> 58       0.58     0.086       0.015
#> 59       0.59     0.085       0.013
#> 60       0.60     0.080       0.013
#> 61       0.61     0.079       0.013
#> 62       0.62     0.075       0.013
#> 63       0.63     0.071       0.013
#> 64       0.64     0.067       0.012
#> 65       0.65     0.063       0.012
#> 66       0.66     0.063       0.011
#> 67       0.67     0.060       0.010
#> 68       0.68     0.059       0.010
#> 69       0.69     0.059       0.010
#> 70       0.70     0.057       0.010
#> 71       0.71     0.055       0.010
#> 72       0.72     0.051       0.010
#> 73       0.73     0.049       0.010
#> 74       0.74     0.048       0.009
#> 75       0.75     0.044       0.008
#> 76       0.76     0.040       0.007
#> 77       0.77     0.036       0.007
#> 78       0.78     0.032       0.007
#> 79       0.79     0.028       0.007
#> 80       0.80     0.027       0.007
#> 81       0.81     0.025       0.007
#> 82       0.82     0.024       0.007
#> 83       0.83     0.023       0.007
#> 84       0.84     0.022       0.005
#> 85       0.85     0.020       0.004
#> 86       0.86     0.017       0.003
#> 87       0.87     0.012       0.003
#> 88       0.88     0.012       0.002
#> 89       0.89     0.010       0.002
#> 90       0.90     0.008       0.002
#> 91       0.91     0.007       0.002
#> 92       0.92     0.007       0.002
#> 93       0.93     0.007       0.002
#> 94       0.94     0.005       0.002
#> 95       0.95     0.005       0.002
#> 96       0.96     0.003       0.001
#> 97       0.97     0.003       0.001
#> 98       0.98     0.002       0.001
#> 99       0.99     0.002       0.001
#> 
#> attr(,"class")
#> [1] "getgamma1cont"