set.seed(123)
## Example of a binary endpoint
## Consider a randomized comparative trial designed to borrow information
## from historical data on the control. We assumed a non-informative prior
## beta(1, 1) and an informative prior beta(30, 50) after incorporating
## the historical data. The treatment is regarded as superior to the control
## if Pr(RR.t > RR.c | data) > 0.95, where RR.t and RR.c are response rates
## of the treatment and control, respectively. The operating characteristics
## were assessed under the scenarios of (RR.c, RR.t) = (0.3, 0.36) and (0.3, 0.56).
## OC <- get_OC(## Informative prior constructed based on historical data
## if.prior = mixbeta(c(1, 30, 50)),
## ## Non-informative prior used for constructing the SAM prior
## nf.prior = mixbeta(c(1,1,1)),
## delta = 0.2, ## Clinically significant difference
## n = 35, ## Sample size for the control arm
## n.t = 70, ## Sample size for the treatment arm
## ## Decision rule to compare the whether treatment is superior
## ## than the control
## decision = decision2S(0.95, 0, lower.tail=FALSE),
## ntrial = 1000, ## Number of trials simulated
## ## Weight assigned to the informative component for MAP prior
## weight = 0.5,
## ## A vector of response rate for the control arm
## theta = c(0.3, 0.36),
## ## A vector of response rate for the treatment arm
## theta.t = c(0.3, 0.56))
## OC
## Example of continuous endpoint
## Consider a randomized comparative trial designed to borrow information
## from historical data on the control. We assumed a non-informative prior
## N(0, 1e4) and an informative prior N(0.5, 2) after incorporating
## the historical data. The treatment is regarded as superior to the control
## if Pr(mean.t > mean.c | data) > 0.95, where mean.t and mean.c are mean
## of the treatment and control, respectively. The operating characteristics
## were assessed under the scenarios of (mean.c, mean.t) = (0.1, 0.1) and
## (0.5, 1.0).
sigma <- 2
prior.mean <- 0.5
prior.se <- sigma/sqrt(100)
## OC <- get_OC(## Informative prior constructed based on historical data
## if.prior = mixnorm(c(1, prior.mean, prior.se)),
## ## Non-informative prior used for constructing the SAM prior
## nf.prior = mixnorm(c(1, 0, 1e4)),
## delta = 0.2 * sigma, ## Clinically significant difference
## n = 100, ## Sample size for the control arm
## n.t = 200, ## Sample size for the treatment arm
## ## Decision rule to compare the whether treatment is superior
## ## than the control
## decision = decision2S(0.95, 0, lower.tail=FALSE),
## ntrial = 1000, ## Number of trials simulated
## ## A vector of mean for the control arm
## theta = c(0.1, 0.5),
## ## A vector of mean for the treatment arm
## theta.t = c(0.1, 1.0),
## sigma = sigma)
## OC
Run the code above in your browser using DataLab