# NOT RUN {
# see Neuenschwander et al., 2011
# example is for a time-to-event trial evaluationg non-inferiority
# using a normal approximation for the log-hazard ratio
# reference scale
s <- 2
theta_ni <- 0.4
theta_a <- 0
alpha <- 0.05
beta <- 0.2
za <- qnorm(1-alpha)
zb <- qnorm(1-beta)
n1 <- round( (s * (za + zb)/(theta_ni - theta_a))^2 ) # n for which design was intended
nL <- 233
c1 <- theta_ni - za * s / sqrt(n1)
# flat prior
prior <- mixnorm(c(1,0,100), sigma=s)
# standard NI design
decA <- oc1Sdecision(1 - alpha, theta_ni, lower.tail=TRUE)
# for double criterion with indecision point (mean estimate must be
# lower than this)
theta_c <- c1
# double criterion design
# statistical significance (like NI design)
dec1 <- oc1Sdecision(1-alpha, theta_ni, lower.tail=TRUE)
# require mean to be at least as good as theta_c
dec2 <- oc1Sdecision(0.5, theta_c, lower.tail=TRUE)
# combination
decComb <- oc1Sdecision(c(1-alpha, 0.5), c(theta_ni, theta_c), lower.tail=TRUE)
theta_eval <- c(theta_a, theta_c, theta_ni)
designA_n1 <- oc1S(prior, n1, decA)
designA_nL <- oc1S(prior, nL, decA)
designC_n1 <- oc1S(prior, n1, decComb)
designC_nL <- oc1S(prior, nL, decComb)
designC1_nL <- oc1S(prior, nL, dec1)
designC2_nL <- oc1S(prior, nL, dec2)
designA_n1(theta_eval)
designA_nL(theta_eval)
designC_n1(theta_eval)
designC_nL(theta_eval)
# note: the decision for the nL case is driven by the second
# criterion (for the mean) only as the critical value is lower
designC1_nL()
designC2_nL()
designC_nL()
# }
Run the code above in your browser using DataLab