Calculates the boundaries at each interim analysis, i.e. the number of events in the experimental group that would lead to a stopping of the trial based on a binomial exact test, assuming that the events should be equally distributed amont both groups. The indicated scenario (and all more extreme) would lead to a rejection of H0 (equal distribution) and a stopping for safety.

getHarmBound(
  nevents,
  alpha_test,
  pH0,
  pH1 = NULL,
  rrH1 = NULL,
  orH1 = NULL,
  rdH1 = NULL,
  r0 = NULL,
  n = NULL
)

Arguments

nevents

vector with number of events at which an interim analysis is done

alpha_test

the nominal alpha level to use for each test

pH0

proportion of events in the experimental arm under the null hypothesis, typically based on randomization ratio (e.g. 0.5 for a 1:1 randomization)

pH1

optional alternative, numeric vector, proportion of events in the experimental arm

rrH1

alternative specification of alternative as risk ratio (experimental / control)

orH1

alternative specification of alternative as risk ratio (experimental / control). Requires the control proportion (r0).

rdH1

alternative specification of alternative as risk difference (experimental - control). Requires the control proportion (r0) and the number of participants (n).

r0

risk in the control group. Required if the alternative is given as risk difference or odds ratio.

n

total number of participants. Required if the alternative is given as risk difference.

Value

a list with 2 data frames: bounds and cum_stop_prob. bounds has a row for each interim analysis and columns for number of events (n), number of events in control and experimental group that would lead to a stop (n_treat, n_control), risk ratio (rr) at that level, and the nominal alpha for each test (alpha_test) the null proportion (pH0), sopping probability (stop_prob_H0), and cumulative stopping probability (cum_stop_prob_H1), and if pH1!=NULL, the alternative proportion (pH1, first one if pH1 has length>1), sopping probability under the first H1 (stop_prob_H1), cumulative stopping probability under the first H1 (cum_stop_prob). cum_stop_prob includes the cumulative stopping probabilities for the null and each alternative.

Examples

getHarmBound(nevents=c(10,50,100), alpha_test=0.025, pH0=0.5)
#> $bounds
#>   events events_exp events_control       rr alpha_test pH0 stop_prob_H0
#> 1     10          9              1 9.000000      0.025 0.5   0.01074219
#> 2     50         33             17 1.941176      0.025 0.5   0.01490030
#> 3    100         61             39 1.564103      0.025 0.5   0.01194192
#>   cum_stop_prob_H0
#> 1       0.01074219
#> 2       0.02564249
#> 3       0.03758441
#> 
#> $cum_stop_prob
#>     p cum_stop_prob hyp
#> 1 0.5    0.03758441  H0
#> 
#> attr(,"class")
#> [1] "harmbound" "list"     
#adding an alternative
getHarmBound(nevents=c(10,50,100), alpha_test=0.025, pH0=0.5, pH1=0.6)
#> $bounds
#>   events events_exp events_control       rr alpha_test pH0 stop_prob_H0
#> 1     10          9              1 9.000000      0.025 0.5   0.01074219
#> 2     50         33             17 1.941176      0.025 0.5   0.01490030
#> 3    100         61             39 1.564103      0.025 0.5   0.01194192
#>   cum_stop_prob_H0 pH1 stop_prob_H1 cum_stop_prob_H1
#> 1       0.01074219 0.6    0.0463574        0.0463574
#> 2       0.02564249 0.6    0.2098108        0.2561682
#> 3       0.03758441 0.6    0.2505214        0.5066895
#> 
#> $cum_stop_prob
#>   hyp   p cum_stop_prob
#> 1  H0 0.5    0.03758441
#> 2  H1 0.6    0.50668952
#> 
#> attr(,"class")
#> [1] "harmbound" "list"     
#or several alternatives
getHarmBound(nevents=c(10,50,100), alpha_test=0.025, pH0=0.5, pH1=seq(0,1,by=0.1))
#> $bounds
#>   events events_exp events_control       rr alpha_test pH0 stop_prob_H0
#> 1     10          9              1 9.000000      0.025 0.5   0.01074219
#> 2     50         33             17 1.941176      0.025 0.5   0.01490030
#> 3    100         61             39 1.564103      0.025 0.5   0.01194192
#>   cum_stop_prob_H0 pH1 stop_prob_H1 cum_stop_prob_H1
#> 1       0.01074219   0            0                0
#> 2       0.02564249   0            0                0
#> 3       0.03758441   0            0                0
#> 
#> $cum_stop_prob
#>    hyp   p cum_stop_prob
#> 1   H0 0.5  3.758441e-02
#> 2   H1 0.0  0.000000e+00
#> 3   H1 0.1  9.100000e-09
#> 4   H1 0.2  4.198402e-06
#> 5   H1 0.3  1.438344e-04
#> 6   H1 0.4  1.856785e-03
#> 7   H1 0.5  3.758441e-02
#> 8   H1 0.6  5.066895e-01
#> 9   H1 0.7  9.817810e-01
#> 10  H1 0.8  9.999970e-01
#> 11  H1 0.9  1.000000e+00
#> 12  H1 1.0  1.000000e+00
#> 
#> attr(,"class")
#> [1] "harmbound" "list"     
#or as risk ratio
getHarmBound(nevents=c(10,50,100), alpha_test=0.025, pH0=0.5, rrH1=1.5)
#> $bounds
#>   events events_exp events_control       rr alpha_test pH0 stop_prob_H0
#> 1     10          9              1 9.000000      0.025 0.5   0.01074219
#> 2     50         33             17 1.941176      0.025 0.5   0.01490030
#> 3    100         61             39 1.564103      0.025 0.5   0.01194192
#>   cum_stop_prob_H0 pH1 stop_prob_H1 cum_stop_prob_H1
#> 1       0.01074219 0.6    0.0463574        0.0463574
#> 2       0.02564249 0.6    0.2098108        0.2561682
#> 3       0.03758441 0.6    0.2505214        0.5066895
#> 
#> $cum_stop_prob
#>   hyp   p  rr cum_stop_prob
#> 1  H0 0.5 1.0    0.03758441
#> 2  H1 0.6 1.5    0.50668952
#> 
#> attr(,"class")
#> [1] "harmbound" "list"