beanz: Bayesian Analysis of Heterogeneous Treatment Effect

Chenguang Wang and Ravi Varadhan

2018-06-13

## Loading required package: beanz
## Loading required package: Rcpp

Introduction

In patient-centered outcomes research, it is vital to assess the heterogeneity of treatment effects (HTE) when making health care decisions for an individual patient or a group of patients. Nevertheless, it remains challenging to evaluate HTE based on information collected from clinical studies that are often designed and conducted to evaluate the efficacy of a treatment for the overall population. The Bayesian framework offers a principled and flexible approach to estimate and compare treatment effects across subgroups of patients defined by their characteristics.

R package beanz provides functions to facilitate the conduct of Bayesian analysis of HTE and a web-based graphical user interface for users to conduct such Bayesian analysis in an interactive and user-friendly manner.

Data accepted by beanz

There are two types of data structures that beanz recognizes:

The beanz package provides dataset solvd.sub from the SOLVD trial as an example Patient level raw data dataset.

Estimate subgroup effect

If Patient level raw data is provided, the package provides function bzGetSubgrpRaw for estimating subgroup effect for each subgroup. The return value from bzGetSubgrpRaw is a data frame with the format of Summary treatment effect data.

The example is as follows:

var.cov    <- c("lvef", "sodium", "any.vasodilator.use");
var.resp   <- "y";
var.trt    <- "trt";
var.censor <- "censor";
resptype   <- "survival";

subgrp.effect <- bzGetSubgrpRaw(solvd.sub,
                                  var.resp   = var.resp,
                                  var.trt    = var.trt,
                                  var.cov    = var.cov,
                                  var.censor = var.censor,
                                  resptype   = resptype);
print(subgrp.effect);
##   Subgroup lvef sodium any.vasodilator.use    Estimate   Variance   N
## 1        1    0      0                   0 -0.37783038 0.01212786 562
## 2        2    0      0                   1 -0.34655336 0.01004499 695
## 3        3    0      1                   0 -0.79235451 0.03939983 237
## 4        4    0      1                   1 -0.39334304 0.02969421 250
## 5        5    1      0                   0  0.06776454 0.04629163 223
## 6        6    1      0                   1 -0.23655764 0.02400353 341
## 7        7    1      1                   0  0.15435495 0.10365396 104
## 8        8    1      1                   1  0.05947290 0.07761840 123

Bayesian HTE models

The function bzCallStan calls rstan::sampling to draw samples for different Bayesian models. The following models are available in the current version of beanz:

The following examples show how No subgroup effect model (nse), Simple regression model* (sr) and Basic shrinkage model (bs) are called:

var.estvar <- c("Estimate", "Variance");

rst.nse <- bzCallStan("nse", dat.sub=subgrp.effect,
                     var.estvar = var.estvar, var.cov = var.cov,
                     par.pri = c(B=1000),
                     chains=4, iter=4000,
                     warmup=2000, seed=1000, cores=1);
## 
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 1).
## 
## Gradient evaluation took 3.3e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.33 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.209209 seconds (Warm-up)
##                0.109354 seconds (Sampling)
##                0.318563 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 2).
## 
## Gradient evaluation took 1e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.1 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.193803 seconds (Warm-up)
##                0.107558 seconds (Sampling)
##                0.301361 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 3).
## 
## Gradient evaluation took 1.1e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.11 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.203569 seconds (Warm-up)
##                0.106237 seconds (Sampling)
##                0.309806 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 4).
## 
## Gradient evaluation took 1e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.1 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.202796 seconds (Warm-up)
##                0.108679 seconds (Sampling)
##                0.311475 seconds (Total)
rst.sr  <- bzCallStan("sr", dat.sub=subgrp.effect,
                     var.estvar = var.estvar, var.cov = var.cov,
                     par.pri = c(B=1000, C=1000),
                     chains=4, iter=4000,
                     warmup=2000,  seed=1000, cores=1);
## 
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 1).
## 
## Gradient evaluation took 3.7e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.37 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.264551 seconds (Warm-up)
##                0.253865 seconds (Sampling)
##                0.518416 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 2).
## 
## Gradient evaluation took 1.4e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.14 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.270933 seconds (Warm-up)
##                0.226016 seconds (Sampling)
##                0.496949 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 3).
## 
## Gradient evaluation took 1.4e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.14 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.273628 seconds (Warm-up)
##                0.32418 seconds (Sampling)
##                0.597808 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 4).
## 
## Gradient evaluation took 1.4e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.14 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.255576 seconds (Warm-up)
##                0.233198 seconds (Sampling)
##                0.488774 seconds (Total)
## Warning: Some Pareto k diagnostic values are too high. See help('pareto-k-
## diagnostic') for details.
rst.bs  <- bzCallStan("bs", dat.sub=subgrp.effect,
                     var.estvar = var.estvar, var.cov = var.cov,
                     par.pri = c(B=1000, D=1),
                     chains=4, iter=4000, warmup=2000,  seed=1000, cores=1);
## 
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 1).
## 
## Gradient evaluation took 2e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.406331 seconds (Warm-up)
##                0.356789 seconds (Sampling)
##                0.76312 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 2).
## 
## Gradient evaluation took 1.3e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.13 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.400501 seconds (Warm-up)
##                0.290767 seconds (Sampling)
##                0.691268 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 3).
## 
## Gradient evaluation took 1.2e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.12 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.411591 seconds (Warm-up)
##                0.286705 seconds (Sampling)
##                0.698296 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 4).
## 
## Gradient evaluation took 1.3e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.13 seconds.
## Adjust your expectations accordingly!
## 
## 
## Iteration:    1 / 4000 [  0%]  (Warmup)
## Iteration:  400 / 4000 [ 10%]  (Warmup)
## Iteration:  800 / 4000 [ 20%]  (Warmup)
## Iteration: 1200 / 4000 [ 30%]  (Warmup)
## Iteration: 1600 / 4000 [ 40%]  (Warmup)
## Iteration: 2000 / 4000 [ 50%]  (Warmup)
## Iteration: 2001 / 4000 [ 50%]  (Sampling)
## Iteration: 2400 / 4000 [ 60%]  (Sampling)
## Iteration: 2800 / 4000 [ 70%]  (Sampling)
## Iteration: 3200 / 4000 [ 80%]  (Sampling)
## Iteration: 3600 / 4000 [ 90%]  (Sampling)
## Iteration: 4000 / 4000 [100%]  (Sampling)
## 
##  Elapsed Time: 0.404179 seconds (Warm-up)
##                0.409505 seconds (Sampling)
##                0.813684 seconds (Total)
## Warning: There were 5 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
## http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
## Warning: Examine the pairs() plot to diagnose sampling problems
## Warning: Some Pareto k diagnostic values are too high. See help('pareto-k-
## diagnostic') for details.

Results presentation

Posterior subgroup treatment effect summary

Posterior subgroup treatment effect can be summarized and presented by functions bzSummary, bzPlot and bzForest. These functions allows to include a subgroup from another model (i.e. No subgroup effect model) as a reference in the results.

Simple regression model

sel.grps <- c(1,4,5);
tbl.sub <- bzSummary(rst.sr, ref.stan.rst=rst.nse, ref.sel.grps=1);
print(tbl.sub);
##                Subgroup   Mean    SD   Q025    Q25 Median    Q75   Q975
## 1            Subgroup 1 -0.401 0.095 -0.586 -0.464 -0.402 -0.336 -0.215
## 2            Subgroup 2 -0.381 0.088 -0.556  -0.44  -0.38 -0.322 -0.208
## 3            Subgroup 3 -0.485  0.13 -0.739 -0.575 -0.485 -0.396 -0.238
## 4            Subgroup 4 -0.465 0.124 -0.709  -0.55 -0.466 -0.382 -0.222
## 5            Subgroup 5 -0.062 0.135 -0.327 -0.151 -0.063   0.03  0.199
## 6            Subgroup 6 -0.042 0.119 -0.277 -0.124 -0.042  0.036  0.193
## 7            Subgroup 7 -0.147 0.161 -0.467 -0.256 -0.145 -0.037  0.166
## 8            Subgroup 8 -0.127 0.148 -0.408 -0.229 -0.128 -0.029  0.163
## 9 No subgroup effect(1) -0.322 0.057 -0.432 -0.361 -0.322 -0.284  -0.21
##   ProbLT0
## 1       1
## 2       1
## 3       1
## 4       1
## 5   0.678
## 6   0.638
## 7   0.821
## 8   0.808
## 9       1
bzPlot(rst.sr, sel.grps = sel.grps, ref.stan.rst=rst.nse, ref.sel.grps=1);

bzForest(rst.sr, sel.grps = sel.grps, ref.stan.rst=rst.nse, ref.sel.grps=1);

Basic shrinkage model

tbl.sub <- bzSummary(rst.bs, ref.stan.rst=rst.nse, ref.sel.grps=1);
print(tbl.sub);
##                Subgroup   Mean    SD   Q025    Q25 Median    Q75   Q975
## 1            Subgroup 1 -0.352 0.096 -0.547 -0.413 -0.349 -0.287 -0.167
## 2            Subgroup 2 -0.333 0.086 -0.505  -0.39 -0.333 -0.276 -0.164
## 3            Subgroup 3 -0.518 0.185 -0.923 -0.641 -0.494 -0.375 -0.233
## 4            Subgroup 4 -0.345  0.13 -0.614 -0.423 -0.341 -0.266 -0.087
## 5            Subgroup 5 -0.141 0.183 -0.431 -0.281 -0.166 -0.022  0.262
## 6            Subgroup 6 -0.267 0.122 -0.492 -0.348 -0.275  -0.19 -0.006
## 7            Subgroup 7 -0.167 0.215 -0.505 -0.318 -0.207 -0.043  0.325
## 8            Subgroup 8  -0.18 0.191 -0.489 -0.315 -0.209 -0.067  0.259
## 9 No subgroup effect(1) -0.322 0.057 -0.432 -0.361 -0.322 -0.284  -0.21
##   ProbLT0
## 1       1
## 2       1
## 3       1
## 4   0.994
## 5    0.78
## 6   0.978
## 7   0.793
## 8   0.832
## 9       1
bzPlot(rst.bs, sel.grps = sel.grps, ref.stan.rst=rst.nse, ref.sel.grps=1);

bzForest(rst.bs, sel.grps = sel.grps, ref.stan.rst=rst.nse, ref.sel.grps=1);

Posterior subgroup treatment effect comparison

Posterior subgroup treatment effect can be compared between subgroups by functions bzSummaryComp, bzPlotComp and bzForestComp.

Simple regression model

tbl.sub <- bzSummaryComp(rst.sr, sel.grps=sel.grps);
print(tbl.sub);
##     Comparison   Mean    SD   Q025    Q25 Median   Q75  Q975 ProbLT0
## 1 Subgroup 4-1 -0.065 0.158 -0.369 -0.172 -0.066  0.04 0.248   0.665
## 2 Subgroup 5-1  0.337 0.164  0.012  0.229  0.335 0.445 0.663   0.021
## 3 Subgroup 5-4  0.406 0.183  0.044  0.284  0.406  0.53 0.758   0.013
bzPlot(rst.sr, sel.grps = sel.grps);

bzForest(rst.sr, sel.grps = sel.grps);

Basic shrinkage model

tbl.sub <- bzSummaryComp(rst.bs, sel.grps=sel.grps);
print(tbl.sub);
##     Comparison  Mean    SD   Q025    Q25 Median   Q75  Q975 ProbLT0
## 1 Subgroup 4-1 0.005 0.163 -0.321 -0.101  0.007 0.112 0.325    0.48
## 2 Subgroup 5-1 0.209 0.208 -0.152  0.061  0.192 0.345 0.653   0.152
## 3 Subgroup 5-4 0.206 0.223 -0.195  0.051   0.19 0.346 0.683   0.177
bzPlotComp(rst.bs, sel.grps = sel.grps);

bzForestComp(rst.bs, sel.grps = sel.grps);

Overall summary

beanz provides function bzRptTbl to generate the summary posterior subgroup treatment effect table from the model selected by DIC (i.e. the model with the smallest DIC):

lst.rst     <- list(nse=rst.nse, sr=rst.sr, bs=rst.bs);
tbl.summary <- bzRptTbl(lst.rst, dat.sub = subgrp.effect, var.cov = var.cov);
print(tbl.summary);
##                         Model Subgroup lvef sodium any.vasodilator.use
## Subgroup 1 No subgroup effect        1    0      0                   0
## Subgroup 2 No subgroup effect        2    0      0                   1
## Subgroup 3 No subgroup effect        3    0      1                   0
## Subgroup 4 No subgroup effect        4    0      1                   1
## Subgroup 5 No subgroup effect        5    1      0                   0
## Subgroup 6 No subgroup effect        6    1      0                   1
## Subgroup 7 No subgroup effect        7    1      1                   0
## Subgroup 8 No subgroup effect        8    1      1                   1
##              Mean    SD Prob < 0
## Subgroup 1 -0.322 0.057        1
## Subgroup 2 -0.322 0.057        1
## Subgroup 3 -0.322 0.057        1
## Subgroup 4 -0.322 0.057        1
## Subgroup 5 -0.322 0.057        1
## Subgroup 6 -0.322 0.057        1
## Subgroup 7 -0.322 0.057        1
## Subgroup 8 -0.322 0.057        1

Predictive distribution

Function bzPredSubgrp generates the predictive distribution of the subgrooup treatment effects.

pred.dist <- bzPredSubgrp(rst.sr,
                                  dat.sub=subgrp.effect,
                                  var.estvar = var.estvar);
head(pred.dist);
##            [,1]       [,2]       [,3]       [,4]        [,5]         [,6]
## [1,] -0.2139431 -0.1950989 -0.7298465 -0.4751291 -0.05987575  0.005320552
## [2,] -0.3214511 -0.3645186 -0.6025874 -0.6090846 -0.06453451  0.138157454
## [3,] -0.4771825 -0.2499599 -0.5938340 -0.6897693  0.25255032 -0.393141590
## [4,] -0.1686947 -0.2174068 -0.3967592 -0.1578458  0.04432626  0.129928079
## [5,] -0.5387784 -0.5184029 -0.5521909 -0.6691116  0.22789620 -0.014631222
## [6,] -0.1453486 -0.4018996 -0.4067673 -0.5256097 -0.19352722  0.044520821
##               [,7]        [,8]
## [1,]  0.0547029104 -0.17041925
## [2,] -0.7211423472 -0.20721475
## [3,] -0.0510737068 -0.19883551
## [4,]  0.1363043133 -0.16918687
## [5,] -0.0009383121  0.30016887
## [6,] -0.0791177689 -0.04636402

Graphical User Interface

With package shiny installed, beaz provides a web-based graphical user interface (GUI) for conducting the HTE analysis in an user-friendly interactive manner. The GUI can be started by

bzShiny();

Toolbox

Package beanz provides function bzGailSimon that implements the Gail-Simon test for qualitative interactions:

gs.pval <- bzGailSimon(subgrp.effect$Estimate,
                       sqrt(subgrp.effect$Variance));
print(gs.pval);
## [1] 0.9191656

The result show that there is no significant qualitative interactions according to the Gail-Simon test.