beanz: Bayesian Analysis of Heterogeneous Treatment Effect

Chenguang Wang and Ravi Varadhan

2018-04-25

## 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.9e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.39 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.201849 seconds (Warm-up)
##                0.099874 seconds (Sampling)
##                0.301723 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.19327 seconds (Warm-up)
##                0.105997 seconds (Sampling)
##                0.299267 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 3).
## 
## 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.198616 seconds (Warm-up)
##                0.1037 seconds (Sampling)
##                0.302316 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 4).
## 
## 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.202981 seconds (Warm-up)
##                0.107145 seconds (Sampling)
##                0.310126 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.2e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.32 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.271606 seconds (Warm-up)
##                0.250544 seconds (Sampling)
##                0.52215 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.26694 seconds (Warm-up)
##                0.220814 seconds (Sampling)
##                0.487754 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 3).
## 
## 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.272687 seconds (Warm-up)
##                0.326605 seconds (Sampling)
##                0.599292 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'sr' 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.257599 seconds (Warm-up)
##                0.229903 seconds (Sampling)
##                0.487502 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 2.1e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.21 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.37765 seconds (Warm-up)
##                0.341235 seconds (Sampling)
##                0.718885 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.378299 seconds (Warm-up)
##                0.270308 seconds (Sampling)
##                0.648607 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.409794 seconds (Warm-up)
##                0.284257 seconds (Sampling)
##                0.694051 seconds (Total)
## 
## 
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 4).
## 
## 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.388557 seconds (Warm-up)
##                0.394767 seconds (Sampling)
##                0.783324 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.062 0.155 -0.363 -0.167 -0.063 0.043  0.24   0.653
## 2 Subgroup 5-1  0.338 0.163   0.01  0.229  0.338 0.447 0.654   0.021
## 3 Subgroup 5-4  0.401 0.184  0.032   0.28  0.401 0.525 0.757   0.018
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.007 0.163 -0.314  -0.1  0.007 0.116 0.329    0.48
## 2 Subgroup 5-1  0.21 0.209 -0.148 0.059  0.185 0.347 0.648   0.152
## 3 Subgroup 5-4 0.205 0.224 -0.194 0.047  0.188 0.351 0.676   0.182
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.4263527 -0.3930179 -0.8375078 -0.7497386  0.21178036  0.22549199
## [2,] -0.7423310 -0.2872170 -0.2184243 -0.3757423 -0.08523739 -0.09269885
## [3,] -0.6977329 -0.5115730 -0.5015731 -0.6156145 -0.09418076 -0.36126591
## [4,] -0.1655108 -0.3200752 -0.1162271 -0.4307843  0.12056762  0.13926286
## [5,] -0.3521789 -0.4503897 -0.6514098 -0.6674357  0.45827897 -0.05660821
## [6,] -0.1874575 -0.2667843 -0.4174008 -0.5004723 -0.10093502 -0.37380070
##             [,7]        [,8]
## [1,] -0.54704653  0.09356269
## [2,]  0.15369553 -0.25408748
## [3,] -0.07697268  0.26090497
## [4,] -0.59235378  0.24959517
## [5,]  0.19140482  0.32242968
## [6,]  0.11188013 -0.51459890

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.