# Hierarchical Bayesian model for binary responses

Thall et al. (2003) described a method for analysing treatment effects of a common intervention in several sub-types of a single disease. The treatment effects are assumed to be different but exchangeable and correlated. Observing good efficacy in one cohort, for example, increases one’s expectations of efficacy in other cohorts.

They demonstrate the hierarchical model in a trial with binary response outcomes and in another with time-to-event outcomes. This vignette describes the sarcoma example with binary response outcomes. The authors provide WinBUGS code in the appendix of their paper (Thall et al. 2003). We port their model to Stan and illustrate usage with the example given in their paper.

# Implementation in trialr

Statistically, the authors assume that in a trial of $$k$$ disease subtypes, the treatment effects are drawn from the same common normal distribution

$$\rho_1, ..., \rho_k \sim N(\mu, \sigma^2)$$

As is the convention in BUGS, the authors define normal distributions by a precision parameter $$\tau$$ as opposed to the standard deviation parameter $$\sigma$$ used here. We have re-specified the model to comply with the Stan convention of using standard deviation. The authors use a normal hyperprior on $$\mu$$, and a gamma hyperprior on $$\tau$$, equivalent to an inverse gamma hyperprior on $$\sigma^2$$.

We observe $$x_i$$ responses in $$n_i$$ patients in disease sub-type $$i$$. The rate of response in subtype $$i$$ is modelled as $$p_i = \text{logit}^{-1}(\rho_i)$$. Each $$x_i$$ is assumed to be binomially distributed with success parameter $$p_i$$. In Stan, that relationship is described as x ~ binomial_logit(n, rho);

The treatment is judged to be worthy of further investigation in cohort $$i$$ if

$$\text{Pr}\left\{ p_i > \theta | \mathcal{D} \right\} > q$$

where $$\theta$$ is the minimum required response rate, and $$q$$ is the required certainty to approve. In their provided example, Thall et al. (2003) use $$\theta = 0.3$$.

# Example

library(trialr)

We reproduce Thall etl al.’s example. We have outcomes in 10 disease subgroups. The number of responses is stored in group_responses and the number of patients in group_sizes. There have been 3 / 7 responses in subgroup 4, for example, but 0 / 2 responses in subgroup 2, and zero patients treated at all in subgroups 1, 6 and 10.

fit <- stan_hierarchical_response_thall(
group_responses = c(0, 0, 1, 3, 5, 0, 1, 2, 0, 0),
group_sizes = c(0, 2 ,1, 7, 5, 0, 2, 3, 1, 0),
mu_mean = -1.3863,
mu_sd = sqrt(1 / 0.1),
tau_alpha = 2,
tau_beta = 20)
fit
## Inference for Stan model: ThallHierarchicalBinary.
## 4 chains, each with iter=2000; warmup=1000; thin=1;
## post-warmup draws per chain=1000, total post-warmup draws=4000.
##
##                     mean se_mean    sd   2.5%    25%    50%    75%  97.5%
## mu                 -0.03    0.03  1.43  -2.99  -0.92  -0.02   0.88   2.74
## sigma2             12.59    0.40 11.95   3.21   6.23   9.43  14.69  43.20
## rho              0.00    0.07  3.88  -7.80  -2.22   0.00   2.21   7.82
## rho             -2.97    0.06  2.53  -9.05  -4.18  -2.49  -1.24   0.54
## rho              2.38    0.06  2.73  -1.84   0.59   1.98   3.68   8.88
## rho             -0.30    0.01  0.77  -1.85  -0.80  -0.28   0.22   1.21
## rho              3.68    0.06  2.29   0.52   2.12   3.26   4.68   9.50
## rho             -0.17    0.06  3.74  -7.96  -2.38  -0.17   2.16   7.32
## rho              0.04    0.02  1.54  -3.10  -0.93   0.05   1.03   3.04
## rho              0.79    0.02  1.30  -1.64  -0.09   0.73   1.60   3.50
## rho             -2.42    0.08  2.89  -9.18  -3.85  -1.99  -0.53   1.80
## rho            -0.03    0.07  3.79  -7.82  -2.25  -0.05   2.24   7.57
## sigma               3.33    0.04  1.23   1.79   2.50   3.07   3.83   6.57
## prob_response    0.50    0.01  0.38   0.00   0.10   0.50   0.90   1.00
## prob_response    0.15    0.00  0.18   0.00   0.01   0.08   0.22   0.63
## prob_response    0.78    0.00  0.25   0.14   0.64   0.88   0.98   1.00
## prob_response    0.43    0.00  0.17   0.14   0.31   0.43   0.56   0.77
## prob_response    0.92    0.00  0.10   0.63   0.89   0.96   0.99   1.00
## prob_response    0.49    0.01  0.38   0.00   0.08   0.46   0.90   1.00
## prob_response    0.51    0.00  0.27   0.04   0.28   0.51   0.74   0.95
## prob_response    0.64    0.00  0.23   0.16   0.48   0.68   0.83   0.97
## prob_response    0.23    0.00  0.26   0.00   0.02   0.12   0.37   0.86
## prob_response   0.50    0.01  0.38   0.00   0.10   0.49   0.90   1.00
## lp__              -34.29    0.13  3.65 -42.55 -36.42 -33.89 -31.55 -28.70
##                   n_eff Rhat
## mu                 2320    1
## sigma2              890    1
## rho             3401    1
## rho             1941    1
## rho             1878    1
## rho             4077    1
## rho             1669    1
## rho             3408    1
## rho             4103    1
## rho             3694    1
## rho             1455    1
## rho            2819    1
## sigma               865    1
## prob_response   3491    1
## prob_response   3593    1
## prob_response   4047    1
## prob_response   4124    1
## prob_response   3634    1
## prob_response   3755    1
## prob_response   4435    1
## prob_response   4272    1
## prob_response   3728    1
## prob_response  3205    1
## lp__                815    1
##
## Samples were drawn using NUTS(diag_e) at Mon Apr  6 12:39:46 2020.
## For each parameter, n_eff is a crude measure of effective sample size,
## and Rhat is the potential scale reduction factor on split chains (at
## convergence, Rhat=1).

The probability of response in each subgroup is calculated under prob_response. We can use the generic summary function from rstan to get a nice summary:

knitr::kable(rstan::summary(fit, par = 'prob_response')\$summary, digits = 3)
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
prob_response 0.500 0.006 0.378 0.000 0.098 0.500 0.901 1.000 3491.422 1.001
prob_response 0.149 0.003 0.179 0.000 0.015 0.077 0.224 0.631 3593.135 1.000
prob_response 0.776 0.004 0.251 0.137 0.642 0.879 0.975 1.000 4047.303 1.000
prob_response 0.434 0.003 0.167 0.136 0.311 0.429 0.556 0.770 4124.412 1.000
prob_response 0.923 0.002 0.100 0.627 0.893 0.963 0.991 1.000 3634.218 1.000
prob_response 0.486 0.006 0.379 0.000 0.084 0.458 0.896 0.999 3754.876 1.000
prob_response 0.508 0.004 0.270 0.043 0.284 0.512 0.737 0.954 4434.865 0.999
prob_response 0.642 0.004 0.229 0.163 0.478 0.676 0.831 0.971 4271.535 1.000
prob_response 0.229 0.004 0.256 0.000 0.021 0.120 0.371 0.858 3728.311 1.000
prob_response 0.499 0.007 0.380 0.000 0.096 0.487 0.903 0.999 3205.348 1.000

Let us say that we are willing to approve the treatment for further study in a subgroup if we have at least $$q = 70$$% certainty that the probability of efficacy exceeds the target response rate of 30%.

colMeans(as.data.frame(fit, pars = 'prob_response') > 0.3)
##  prob_response  prob_response  prob_response  prob_response
##           0.60700           0.17175           0.92300           0.76775
##  prob_response  prob_response  prob_response  prob_response
##           0.99950           0.58875           0.73325           0.90150
##  prob_response prob_response
##           0.30850           0.60500

On that basis, at this interim stage, we would be eager to approve the treatment in subgroups 3, 5 and 8. Subgroups 4 and 7 are close to the boundary.

Some distribution plots of the probabilities of efficacy in some subgroups may be informative.

library(ggplot2)
library(rstan)
library(dplyr)

plot(fit, pars = 'prob_response') +
geom_vline(xintercept = 0.3, col = 'orange', linetype = 'dashed') +
labs(title = 'Partially-pooled analysis of response rate in 10 sarcoma subtypes') Prob(Response | D) in subgroup 3

We see that the inferred efficacy in subgroup 5 is very high. In contrast, efficacy is subject to more uncertainty in subgroup 4, but the majority of the mass clearly lies to the right of 30%.

# trialr

trialr is available at https://github.com/brockk/trialr and https://CRAN.R-project.org/package=trialr