Title: | Bayesian Augmented Control for Clinical Trials |
---|---|
Description: | Implements the Bayesian Augmented Control (BAC, a.k.a. Bayesian historical data borrowing) method under clinical trial setting by calling 'Just Another Gibbs Sampler' ('JAGS') software. In addition, the 'BACCT' package evaluates user-specified decision rules by computing the type-I error/power, or probability of correct go/no-go decision at interim look. The evaluation can be presented numerically or graphically. Users need to have 'JAGS' 4.0.0 or newer installed due to a compatibility issue with 'rjags' package. Currently, the package implements the BAC method for binary outcome only. Support for continuous and survival endpoints will be added in future releases. We would like to thank AbbVie's Statistical Innovation group and Clinical Statistics group for their support in developing the 'BACCT' package. |
Authors: | Hongtao Zhang [aut, cre], Qi Tang [aut] |
Maintainer: | Hongtao Zhang <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0 |
Built: | 2024-11-23 06:31:47 UTC |
Source: | CRAN |
Implements the Bayesian Augmented Control (BAC, a.k.a. Bayesian historical data borrowing) method under clinical trial setting by calling 'Just Another Gibbs Sampler' ('JAGS') software. In addition, the 'BACCT' package evaluates user-specified decision rules by computing the type-I error/power, or probability of correct go/no-go decision at interim look. The evaluation can be presented numerically or graphically. Users need to have 'JAGS' 4.0.0 or newer installed due to a compatibility issue with 'rjags' package. Currently, the package implements the BAC method for binary outcome only. Support for continuous and survival endpoints will be added in future releases. We would like to thank AbbVie's Statistical Innovation group and Clinical Statistics group for their support in developing the 'BACCT' package.
JAGS software can be downloaded from http://mcmc-jags.sourceforge.net/.
Viele, et al., "Use of historical control data for assessing treatment effects in clinical trials." Pharmaceutical statistics 13(1) (2014): 41-54.
## Not run: library(BACCT) ############################# #Example for binary response# ############################# #specify historical data yh = c(11,305,52);nh = c(45,874,120) #specify subjects n1 = 20;n2 = 30 #implement BAC and wait patiently post = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="diff",sim.mode="express") #evaluate the decision rule1 = decision_eval(object=post,decision.rule=c(0.05,0.05), control.range=seq(0.3,0.5,0.01),es=c(0,0.1,0.15),csv.name="rule1.csv") #plot the decision evaluation (fig1 = plot(rule1)) #continue polishing the figure #add data points fig1 + geom_point(size=4) #replace the title fig1 + ggtitle("replace title") #add reference lines fig1 + geom_hline(aes(yintercept=0.05)) + geom_vline(aes(xintercept=0.42),color="black",type="dashed") ## End(Not run)
## Not run: library(BACCT) ############################# #Example for binary response# ############################# #specify historical data yh = c(11,305,52);nh = c(45,874,120) #specify subjects n1 = 20;n2 = 30 #implement BAC and wait patiently post = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="diff",sim.mode="express") #evaluate the decision rule1 = decision_eval(object=post,decision.rule=c(0.05,0.05), control.range=seq(0.3,0.5,0.01),es=c(0,0.1,0.15),csv.name="rule1.csv") #plot the decision evaluation (fig1 = plot(rule1)) #continue polishing the figure #add data points fig1 + geom_point(size=4) #replace the title fig1 + ggtitle("replace title") #add reference lines fig1 + geom_hline(aes(yintercept=0.05)) + geom_vline(aes(xintercept=0.42),color="black",type="dashed") ## End(Not run)
Calling JAGS to implement BAC for binary responses
BAC_binom(yh, nh, n1, n2, y1.range = 0:n1, y2.range = 0:n2, n.chain = 5, tau.alpha = 0.001, tau.beta = 0.001, prior.type = "nonmixture", criterion.type = c("diff", "prob"), prob.threshold, sim.mode = c("full", "express"))
BAC_binom(yh, nh, n1, n2, y1.range = 0:n1, y2.range = 0:n2, n.chain = 5, tau.alpha = 0.001, tau.beta = 0.001, prior.type = "nonmixture", criterion.type = c("diff", "prob"), prob.threshold, sim.mode = c("full", "express"))
yh , nh
|
Vector of the numbers of events (subjects) in the historical trial(s). Must be of equal length. |
n1 , n2
|
Number of subjects in the control or treatment arm of the current trial. |
y1.range , y2.range
|
Number of events in control or treatment arm of the current trial. See "Details". |
n.chain |
Controls the number of posterior samples. Each chain contains 20,000 samples. |
tau.alpha , tau.beta
|
Hyperparameters of the inverse gamma distribution controling the extent of borrowing. |
prior.type |
Type of prior on control groups. Currenly, only the inverse-gamma prior is implemented. |
criterion.type |
Type of posterior quantities to be monitored. See "Details." |
prob.threshold |
For |
sim.mode |
Simulation duration reduces greatly in |
There are two types of posterior quantities for
criterion.type
argument. With "diff"
option, the quantity
computed is ; with
"prob,"
such quantity is
, where
is specified by
prob.threshold
argument.
By default, y1.range
and y2.range
cover all possible outcomes
and should be left unspecified in most cases. However, when n1
and/or n2
is fairly large, it is acceptable to use a reduced range
that covers the outcomes that are most likely (e.g., within 95% CI) to be
observed. This may help shorten the time to run MCMC.
Another way that can greatly shorten the MCMC running time is to specify
"express"
mode in sim.mode
argument. Express mode reduces the
number of simulations from length(y1.range)*length(y2.range)
to
length(y1.range)+length(y2.range)
. Express mode is proper when the
treatment arm rate is independent of control arm rate.
An object of class "BAC".
Hongtao Zhang
## Not run: library(BACCT) #borrow from 3 historical trials# yh = c(11,300,52);nh = c(45,877,128) #specify current trial sample sizes# n1 = 20;n2 = 30 #Difference criterion type in full simulation mode# obj1 = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="diff",sim.mode="full") #Probability criterion type in express simulation mode# obj2 = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="prob",prob.threshold=0.1,sim.mode="express") #S3 method for class "BAC" summary(obj1) ## End(Not run)
## Not run: library(BACCT) #borrow from 3 historical trials# yh = c(11,300,52);nh = c(45,877,128) #specify current trial sample sizes# n1 = 20;n2 = 30 #Difference criterion type in full simulation mode# obj1 = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="diff",sim.mode="full") #Probability criterion type in express simulation mode# obj2 = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="prob",prob.threshold=0.1,sim.mode="express") #S3 method for class "BAC" summary(obj1) ## End(Not run)
Applies a decision rule to a "BAC" class object and provides rule evaluation
decision_eval(object, decision.rule, control.range, es, csv.name = NULL)
decision_eval(object, decision.rule, control.range, es, csv.name = NULL)
object |
An object of class "BAC". |
decision.rule |
A vector of |
control.range |
A vector of control rates at which the decision rule is evaluated. |
es |
A vector of treatment arm effect sizes, compared to control arm. |
csv.name |
If a name is specified, the output data set is exported in CSV format. |
The decision rules specified in c(a,b)
may be in the context
of either interim or final analysis. At the interim, a "go" decision is made
if the criterion in the "BAC" object exceeds b
and a "no go" decision
if such criterion is below a
. Otherwise, the decision falls in the
gray zone.
For the final analysis, the decision rule should satisfy a
=b
.
Significance is claimed if the criterion in the "BAC" object exceeds
a
. Specifying an a
larger than b
will lead to an error.
For interim analysis, specified decision rule is evaluated by the probability of making a correct go or no go decision. For final analysis, power or type-I error is computed.
Negative es
values are allowed if a lower rate is desirable.
An object of class "BACdecision".
Hongtao Zhang
## Not run: #borrow from 3 historical trials# yh = c(11,300,52);nh = c(45,877,128) #specify current trial sample sizes# n1 = 20;n2 = 30 obj = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="prob",prob.threshold=0.1,sim.mode="express") rule = decision_eval(obj,decision.rule=c(0.05,0.15), control.range=seq(0.3,0.5,0.01),es=c(0,0.1,0.2),csv.name="result.csv") #S3 method for class "BACdecision" plot(rule,interim=T) ## End(Not run)
## Not run: #borrow from 3 historical trials# yh = c(11,300,52);nh = c(45,877,128) #specify current trial sample sizes# n1 = 20;n2 = 30 obj = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="prob",prob.threshold=0.1,sim.mode="express") rule = decision_eval(obj,decision.rule=c(0.05,0.15), control.range=seq(0.3,0.5,0.01),es=c(0,0.1,0.2),csv.name="result.csv") #S3 method for class "BACdecision" plot(rule,interim=T) ## End(Not run)
Visualizing a decision rule for binary endpoint using heatmap plots
heatmap_decision(object, decision.rule, y1.display = NA, y2.display = NA)
heatmap_decision(object, decision.rule, y1.display = NA, y2.display = NA)
object |
An object of "BAC" class. |
decision.rule |
A vector of |
y1.display , y2.display
|
A subset of control/treatment number of events to be displayed. |
Hongtao Zhang
## Not run: #borrow from 3 historical trials# yh = c(11,300,52);nh = c(45,877,128) #specify current trial sample sizes# n1 = 20;n2 = 30 obj = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="prob",prob.threshold=0.1,sim.mode="express") #generate full heatmap heatmap_decision(obj,decision.rule=c(0.05,0.15)) #generate partial heatmap heatmap_decision(obj,decision.rule=c(0.05,0.15),y1.display=5:15,y2.display=10:25) ## End(Not run)
## Not run: #borrow from 3 historical trials# yh = c(11,300,52);nh = c(45,877,128) #specify current trial sample sizes# n1 = 20;n2 = 30 obj = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5, criterion.type="prob",prob.threshold=0.1,sim.mode="express") #generate full heatmap heatmap_decision(obj,decision.rule=c(0.05,0.15)) #generate partial heatmap heatmap_decision(obj,decision.rule=c(0.05,0.15),y1.display=5:15,y2.display=10:25) ## End(Not run)
plot
method for class "BACdecision"
## S3 method for class 'BACdecision' plot(x, es.null = 0, es.null.side, interim = F, ...)
## S3 method for class 'BACdecision' plot(x, es.null = 0, es.null.side, interim = F, ...)
x |
An object of "BACdecision" class. |
es.null |
Effect size under the null hypothesis. Default is 0. |
es.null.side |
"=" is the only option now. |
interim |
Logical indicator of interim analysis (versus final analysis). Figures will differ in legends and titles. |
... |
Argument to be passed to or from other methods |
If interim=F
, only one power/type I error figure will be
generated. Otherwise, two figures will be generated correponding to "No Go"
and "Go" decisions respectively.
An object of "ggplot" class. Certain further edits are still allowed, such as changing title and adding reference lines.
Hongtao Zhang
summary
method for class "BAC"
## S3 method for class 'BAC' summary(object, ...)
## S3 method for class 'BAC' summary(object, ...)
object |
An object of class "BAC" |
... |
Argument to be passed to or from other methods |
Hongtao Zhang