BayesDP

Shawn Balcome

2017-05-03

Introduction

The purpose of this vignette is to introduce the bdpbinomial function. bdpbinomial is used for estimating posterior samples from a Binomial event rate outcome for clinical trials where an informative prior is used. In the parlance of clinical trials, the informative prior is derived from historical data. The weight given to the historical data is determined using what we refer to as a discount function. There are three steps in carrying out estimation:

  1. Estimation of the historical data weight, denoted \(\hat{\alpha}\), via the discount function

  2. Estimation of the posterior distribution of the current data, conditional on the historical data weighted by \(\hat{\alpha}\)

  3. If a two-arm clinical trial, estimation of the posterior treatment effect, i.e., treatment versus control

Throughout this vignette, we use the terms current, historical, treatment, and control. These terms are used because the model was envisioned in the context of clinical trials where historical data may be present. Because of this terminology, there are 4 potential sources of data:

  1. Current treatment data: treatment data from a current study

  2. Current control data: control (or other treatment) data from a current study

  3. Historical control data: treatment data from a previous study

  4. Historical control data: control (or other treatment) data from a previous study

If only treatment data is input, the function considers the analysis a one-arm trial. If treatment data + control data is input, then it is considered a two-arm trial.

Estimation of the historical data weight

In the first estimation step, the historical data weight \(\hat{\alpha}\) is estimated. In the case of a two-arm trial, where both treatment and control data are available, an \(\hat{\alpha}\) value is estimated separately for each of the treatment and control arms. Of course, historical treatment or historical control data must be present, otherwise \(\hat{\alpha}\) is not estimated for the corresponding arm.

When historical data are available, estimation of \(\hat{\alpha}\) is carried out as follows. Let \(y\) and \(N\) denote the number of events and sample size of the current data, respectively. Similarly, let \(y_0\) and \(N_0\) denote the number of events and sample size of the historical data, respectively. Let \(a_0\) and \(b_0\) denote the rate parameters of a Beta distribution. Then, the posterior distributions of the event rates for current and historical data, under vague (flat) priors are

\[ \tilde{\theta}\mid y,N \sim \mathcal{B}eta\left(y+a_0,\,N-y+b_0 \right)\] and

\[ \theta_0\mid y_0,N_0 \sim \mathcal{B}eta\left(y_0+a_0,\,N_0-y_0+b_0 \right),\] respectively. We next compute the posterior probability \(p = Pr\left(\tilde{\theta} \lt \theta_0\mid y, N, y_0, N_0\right)\). Finally, for a Weibull distribution function (i.e., the Weibull cumulative distribution function), denoted \(W\), \(\hat{\alpha}\) is computed as

\[ \begin{array}{ccc} \mbox{One-sided analysis} & & \mbox{Two-sided analysis} \\ \hat{\alpha}=\alpha_{max}\cdot W\left(p, \,w_{shape}, \,w_{scale}\right), & & \hat{\alpha}=\begin{cases} \alpha_{max}\cdot W\left(p, \,w_{shape}, \,w_{scale}\right),\,0\le p\le0.5\\ \alpha_{max}\cdot W\left(1-p, \,w_{shape}, \,w_{scale}\right),\,0.5 \lt p \le 1, \end{cases} \end{array} \] where \(w_{shape}\) and \(w_{scale}\) are the shape and scale of the Weibull distribution function, respectively and \(\alpha_{max}\) scales the weight \(\hat{\alpha}\) by a user-input maximum value. Using the default values of \(w_{shape}=3\) and \(w_{scale}=0.135\), \(\hat{\alpha}\) increases to 1 as \(p\) increases to 1 (one-sided) and \(\hat{\alpha}\) increases to 1 as \(p\) goes to 0.5 (two-sided).

There are several model inputs at this first stage. First, the user can select fix_alpha=TRUE and force a fixed value of \(\hat{\alpha}\) (at the alpha_max input), as opposed to estimation via the discount function. Next, a Monte Carlo estimation approach is used, requiring several samples from the posterior distributions. Thus, the user can input a sample size greater than or less than the default value of number_mcmc=10000. Next, the Beta rate parameters can be changed from the defaults of \(a_0=b_0=1\) (a0 and b0 inputs). Finally, the shape of the Weibull discount function can be altered by changing the Weibull shape and scale parameters from the default values of \(w_{shape}=3\) and \(w_{scale}=0.135\) (weibull_shape and weibull_scale inputs).

With the historical data weight \(\hat{\alpha}\) in hand, we can move on to estimation of the posterior distribution of the current data.

Discount function

Throughout this vignette, we refer to a discount function. The discount function is a Weibull distribution function and has the form \[W(x) = 1 - \exp\left\{- (x/w_{scale})^{w_{shape}}\right\}.\] During estimation, a user may be interested in selecting values of \(w_{shape}\) and \(w_{scale}\) that result in optimal statistical properties of the analysis. Thus, the discount function can be used to control the false positive rate (type I error) and/or the false negative rate (type II error). Examples in a following section illustrate the shape of the discount function using the default shape and scale parameters.

Another important aspect related to the discount function is the analysis type: one-sided or two-sided. The sidedness of the analysis is analogous to a one- or two-sided hypothesis test. Using the default shape and scale inputs, a two-sided analysis type results in a discount function with the following curve:

The discount function of a one-sided analysis, again with the default shape and scale inputs, has the following curve:

In both of the above plots, the x-axis is the stochastic comparison between current and historical data, which we’ve denoted \(p\). The y-axis is the discount value \(\hat{\alpha}\) that corresponds to a given value of \(p\).

Estimation of the posterior distribution of the current data, conditional on the historical data

With \(\hat{\alpha}\) in hand, we can now estimate the posterior distribution of the current data event rate. Using the notation of the previous section, the posterior distribution is \[\theta \sim \mathcal{B}eta\left(y+y_0\hat{\alpha}+a_0,\, N-y+\hat{\alpha}(N_0-y_0)+b_0 \right).\] At this model stage, we have in hand number_mcmc simulations from the augmented event rate distribution. If there are no control data, i.e., a one-arm trial, then the modeling stops and we generate summaries of the posterior distribution of \(\theta\). Otherwise, if there are control data, we proceed to a third step and compute a comparison between treatment and control data.

Estimation of the posterior treatment effect: treatment versus control

This step of the model is carried out on-the-fly using the summary or print methods. Let \(\theta_T\) and \(\theta_C\) denote posterior event rate estimates of the treatment and control arms, respectively. Currently, the implemented comparison between treatment and control is the difference, i.e., summary statistics related to the posterior difference: \(\theta_T - \theta_C\). In a future release, we may consider implementing additional comparison types.

Function inputs

The data inputs for bdpbinomial are y_t, N_t, y0_t, N0_t, y_c, N_c, y0_c, and N0_c. The data must be input as (y, N) pairs. For example, y_t, the number of events in the current treatment group, must be accompanied by N_t, the sample size of the current treatment group. Historical data inputs are not necessary, but using this function would not be necessary either.

At the minimum, y_t and N_t must be input. In the case that only y_t and N_t are input, the analysis is analogous to using prop.test. Each of the following input combinations are allowed:

Examples

One-arm trial

Suppose we have historical data with y0_t=25 events out of a sample size of N0_t=250 patients. This gives a historical event rate of 0.1. Now, suppose we have current data with y_t=10 events out of a sample size of N_t=200 patients, giving an event rate of 0.05. To illustrate the approach, let’s first give full weight to the historical data. This is accomplished by setting alpha_max=1 and fix_alpha=TRUE as follows:

set.seed(42)
fit1 <- bdpbinomial(y_t       = 10,
                    N_t       = 200,
                    y0_t      = 25,
                    N0_t      = 250,
                    alpha_max = 1,
                    fix_alpha = TRUE)
summary(fit1)
## 
##     One-armed bdp binomial
## 
## Current treatment data: 10 and 200
## Historical treatment data: 25 and 250
## Stochastic comparison (p_hat) - treatment (current vs. historical data): 0.9753
## Discount function value (alpha) - treatment: 1
## 95 percent confidence interval: 
##  0.0568  0.1068
## augmented sample estimate:
## probability of success
##  0.0792

Based on the summary output of fit1, we can see that the value of alpha was held fixed at 1. The resulting (augmented) event rate was estimated at 0.0792 which is approximately the event rate if we combined the historical and current data together, i.e., (10 + 25) / (200 + 250) = 0.078. Note that the print and summary methods result in the same output.

Now, let’s relax the constraint on fixing alpha at 1. We’ll also take this opportunity to describe the output of the plot method.

set.seed(42)
fit1a <- bdpbinomial(y_t       = 10,
                     N_t       = 200,
                     y0_t      = 25,
                     N0_t      = 250,
                     alpha_max = 1,
                     fix_alpha = FALSE)
summary(fit1a)
## 
##     One-armed bdp binomial
## 
## Current treatment data: 10 and 200
## Historical treatment data: 25 and 250
## Stochastic comparison (p_hat) - treatment (current vs. historical data): 0.0247
## Discount function value (alpha) - treatment: 0.0061
## 95 percent confidence interval: 
##  0.0282  0.0901
## augmented sample estimate:
## probability of success
##  0.0535

When alpha is not constrained to one, it is estimated based on a comparison between the current and historical data. We see that the stochastic comparison, p_hat, between historical and control is 0.9762. Here, p_hat is the posterior probability that the current event rate is less than the historical event rate under vague priors. With the present example, p_hat = 0.9762 implies that the current and historical event rates are very different. The result is that the weight given to the historical data is shrunk towards zero. Thus, the estimate of alpha from the discount function is 0.0061, essentially zero, and the augmented posterior estimate of the event rate is approximately the event rate of 0.05 observed in the current data.

Many of the the values presented in the summary method are accessible from the fit object. For instance, alpha is found in fit1a$posterior_treatment$alpha_discount and p_hat is located at fit1a$posterior_treatment$p_hat. The augmented probability of success and confidence interval are computed at run-time. The results can be replicated as:

mean_augmented <- round(median(fit1a$posterior_treatment$posterior),4)
CI95_augmented <- round(quantile(fit1a$posterior_treatment$posterior, prob=c(0.025, 0.975)),4)

Finally, we’ll explore the plot method.

plot(fit1a)

The top plot displays three density curves. The blue curve is the density of the historical event rate, the green curve is the density of the current event rate, and the red curve is the density of the current event rate augmented by historical data. Since little weight was given to the historical data, the current and posterior event rates essentially overlap.

The middle plot simply re-displays the posterior event rate.

The bottom plot displays the discount function (solid curve) as well as alpha (horizontal dashed line) and p_hat (vertical dashed line). In the present example, the discount function is the Weibull probability distribution with shape=3 and scale=0.135.

Two-arm trial

On to two-arm trials. In this package, we define a two-arm trial as an analysis where a current and/or historical control arm is present. Suppose we have the same treatment data as in the one-arm example, but now we introduce control data: y_c = 15, N_c = 200, y0_c = 20, and N0_c = 250. This control data gives a current event rate of 15/200 = 0.075 and a historical event rate of 20/250 = 0.08.

Before proceeding, it is worth pointing out that the discount function is applied separately to the treatment and control data. Now, let’s carry out the two-arm analysis using default inputs:

set.seed(42)
fit2 <- bdpbinomial(y_t  = 10,
                    N_t  = 200,
                    y0_t = 25,
                    N0_t = 250,
                    y_c  = 15,
                    N_c  = 200,
                    y0_c = 20,
                    N0_c = 250)
summary(fit2)
## 
##     Two-armed bdp binomial
## 
## Current treatment data: 10 and 200
## Current control data: 15 and 200
## Historical treatment data: 25 and 250
## Historical control data: 20 and 250
## Stochastic comparison (p_hat) - treatment (current vs. historical data): 0.0247
## Stochastic comparison (p_hat) - control (current vs. historical data): 0.4285
## Discount function value (alpha) - treatment: 0.0061
## Discount function value (alpha) - control: 1
## alternative hypothesis:  two.sided
## 95 percent confidence interval:
##   -0.0628 0.0161
## augmented sample estimates:
## prop 1 prop2
##   0.05  0.08

The summary method of a two-arm analysis is slightly different than a one-arm analysis. First, we see p_hat and alpha reported for the control data. In the present analysis, the current and historical control data have event rates that are very close, thus the historical control data is given full weight. This implies that the (augmented) posterior control event rate is approximately (15 + 20)/(200 + 250) = 0.08. Again, little weight is given to the historical treatment data, so we have an (augmented) posterior treatment event rate of approximately 0.05.

The confidence interval is computed at run time and is the interval estimate of the difference between the posterior treatment and control event rates. With a 95% confidence interval of (-0.0628, 0.0161), we would conclude that the treatment and control arms are not significantly different.

The plot method of a two-arm analysis is slightly different than a one-arm analysis as well:

plot(fit2)

Each of the three plots are analogous to the one-arm analysis, but each plot now presents additional data related to the control arm.