Application in Drug Trials
The 5 text files below provide code in R and BUGS allowing us to perform
Bayesian sample size calculations similar to those done for the NNRTI drug
trial in Section 3 of the paper given above by Hobbs and Carlin
(2007). Consult Dr. Carlin's
BRugs page for instructions on downloading and installing R software and
the BRugs package. Then follow these steps:
Save each of the text files (below) into the same
directory with the same filenames.
WARNING: DON'T save these files by right-clicking in Explorer;
instead, open the file and do "File-Save As", *OR* (better yet) open the file
and copy-paste it into a .txt file to ensure proper decoding of carriage returns!!!
Launch R and change the working directory appropriately ("Change
dir..." under the File menu).
Load the BRugs package and source "drug_design.txt" by typing into the R
console:
library("BRugs")
source("drug_design.txt")
To compute empirical probabilities for each of the six decisions in
Figure 1 with 160 subjects (per group) and
indifference zone boundaries corresponding to phi=0.30, submit to R:
results <- drug.design(160,0.30)
Then the list "results" contains empirical probability tables for each model. These can
be returned by typing:
results$reference; results$skeptical; results$optimistic
Also "results" stores all 95% posterior interval limits generated during the
simulation. For each of the 3 models and 7 "true" deltas there exists "ITER" credible intervals.
These can be returned by typing:
R code
- drug_design.txt contains the R
function, "drug.design", which simulates empirical probabilities for the six possible outcomes of
the NNRTI drug trial given in Figure 1. This function
generates fake data values from design priors and logistic-binomial likelihood in R and produces a
posterior distribution for the odds of viral suppression for EFV (treatment)
versus NVP (control) given the fake data using the BRugs package to call OpenBUGS
within R for each model (or fitting prior). Then each 95% posterior
interval is compared to the indifference zone and the procedure is repeat. The "drug.design"
function has two arguments: "size" specifies the sample size (per group) for each fake dataset and
"phi" designates the indifference zone boundaries.
The function outputs tables of the estimated outcome empirical
probabilities by "true" delta=1,1.1,1.2,1.3,1.4,1.5,1.6 for each model, as
well as a matrix of the generated 95% posterior interval limits. Lastly, the
design function also plots the empirical probabilities of equivalence (red)
and non-equivalence (blue) decisions by true delta, see Figure 5. (Note: the code as it is will take a very long time to
run, however you can reduce the number of reptitions by decreasing the variable "ITER".)
BUGS code
-
optimistic_model.txt BUGS code for the statistical model with
fitting priors optimistic to the superiority of EFV for VS.
-
reference_model.txt BUGS code for the statistical model with non-informative
fitting priors.
-
skeptical_model.txt BUGS code for the statistical model with fitting
priors skeptical to the superiority of EFV for VS.
- inits.txt vector of starting values for the
logistic regression coefficient parameters used by the Gibbs sampler.
The 6 text files below provide code in R and BUGS allowing us to perform
Bayesian sample size calculations similar to those done for the LVAD device
trial in Section 4 of the paper given above by Hobbs and Carlin
(2007). Follow these steps:
Save each of the text files (below) into the same
directory with the same filenames.
WARNING: DON'T save these files by right-clicking in Explorer;
instead, open the file and do "File-Save As", *OR* (better yet) open the file
and copy-paste it into a .txt file to ensure proper decoding of carriage returns!!!
Launch R and change the working directory appropriately ("Change
dir..." under the File menu).
Load the BRugs package, source "device_design.txt" and "create_inits.txt" by
typing into the R console:
library("BRugs")
source("device_design.txt")
source("create_inits.txt")
To compute empirical probabilities for each of the six decisions in
Figure 1 with interim evaluations after 100,
150, 200, 250, 300 survival events (per group) with "true" delta=0.5 and indifference
zone boundaries corresponding to phi=0.50, submit to R:
results <- device.design(0.5,0.5)
The list "results" contains an empirical probability table for each historical
data. These can be returned by typing:
results$genuine; results$pessimistic; results$enthusiastic
R code
- device_design.txt contains 3 R
functions used to simulate empirical probabilities for the six possible outcomes given
in Figure 1 for an LVAD trial with interim
evaluations. The "events" function generates fake survival times from the baseline
gamma process for provided discrepancy in relative risk or hazard ratio ("delta") among
LVAD1 and LVAD2 subjects. 300 LVAD2 and 300-68=232 LVAD1 (we have 68 historical controls) event times
are always generated in "events".
The "interim.monitoring" function calls "events" then cumulatively samples from the 532
current events, generates a posterior distribution for delta using BRugs, and compares the 95% posterior
interval to the indifference zone for samples containing n=100,150,200,250,300 events (per
group). This function's one argument, "phi", designates the
indifference zone boundaries.
The "device.design" function calls "interim.monitoring" 3 times for each historical
control data. See Table 7 for the published result. (Note:
the code as it is will take a very long time to run, however you can reduce the number of
reptitions by decreasing the variable "ITER".)
- genuine.txt R list containing the genuine
historical data representing the survival experience for subjects assigned LVAD1 in
REMATCH.
- pessimistic.txt R list containing historical
data generated from the historical gamma process that is pessimistic with regard to the
survival experienced by subjects assigned LVAD1 in REMATCH.
- enthusiastic.txt R list containing historical
data generated from the historical gamma process that is enthusiastic with regard to the
survival experienced by subjects assigned LVAD1 in REMATCH.
- create_inits.txt R code to create and
choose proper initial values for dL0 and beta parameters.
BUGS code
-
Cox_model.txt BUGS code for the Cox model using the counting process notation
introduced by Anderson and Gill (1982). This MCMC-Bayes formulation of Cox regression is
explained in the BUGS manual in the context of the Leuk
example. A non-informative fitting prior for the beta parameter is used in this
model.