## Loading required package: beanz
## Loading required package: Rcpp
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.
There are two types of data structures that beanz recognizes:
Summary treatment effect data: Each row should represent a subgroup with covariates that define the subgroup, estimated treatment effect in the subgroup and variance for the estimation.
Patient level raw data: Each row should represent a patient with covariates that define the subgroup in which the patient belongs to, treatment indicator and outcome. The outcome can be binary, continuous, or time to event.
The beanz package provides dataset solvd.sub from the SOLVD trial as an example Patient level raw data dataset.
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
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).
## Chain 1:
## Chain 1: Gradient evaluation took 1.3e-05 seconds
## Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.13 seconds.
## Chain 1: Adjust your expectations accordingly!
## Chain 1:
## Chain 1:
## Chain 1: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 1: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 1: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 1: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 1: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 1: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 1: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 1: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 1: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 1: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 1: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 1: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 1:
## Chain 1: Elapsed Time: 0.083 seconds (Warm-up)
## Chain 1: 0.055 seconds (Sampling)
## Chain 1: 0.138 seconds (Total)
## Chain 1:
##
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 2).
## Chain 2:
## Chain 2: Gradient evaluation took 6e-06 seconds
## Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.06 seconds.
## Chain 2: Adjust your expectations accordingly!
## Chain 2:
## Chain 2:
## Chain 2: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 2: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 2: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 2: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 2: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 2: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 2: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 2: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 2: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 2: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 2: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 2: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 2:
## Chain 2: Elapsed Time: 0.083 seconds (Warm-up)
## Chain 2: 0.055 seconds (Sampling)
## Chain 2: 0.138 seconds (Total)
## Chain 2:
##
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 3).
## Chain 3:
## Chain 3: Gradient evaluation took 6e-06 seconds
## Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.06 seconds.
## Chain 3: Adjust your expectations accordingly!
## Chain 3:
## Chain 3:
## Chain 3: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 3: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 3: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 3: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 3: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 3: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 3: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 3: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 3: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 3: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 3: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 3: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 3:
## Chain 3: Elapsed Time: 0.084 seconds (Warm-up)
## Chain 3: 0.055 seconds (Sampling)
## Chain 3: 0.139 seconds (Total)
## Chain 3:
##
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 4).
## Chain 4:
## Chain 4: Gradient evaluation took 6e-06 seconds
## Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.06 seconds.
## Chain 4: Adjust your expectations accordingly!
## Chain 4:
## Chain 4:
## Chain 4: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 4: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 4: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 4: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 4: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 4: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 4: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 4: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 4: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 4: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 4: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 4: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 4:
## Chain 4: Elapsed Time: 0.086 seconds (Warm-up)
## Chain 4: 0.055 seconds (Sampling)
## Chain 4: 0.141 seconds (Total)
## Chain 4:
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).
## Chain 1:
## Chain 1: Gradient evaluation took 1.4e-05 seconds
## Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.14 seconds.
## Chain 1: Adjust your expectations accordingly!
## Chain 1:
## Chain 1:
## Chain 1: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 1: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 1: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 1: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 1: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 1: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 1: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 1: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 1: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 1: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 1: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 1: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 1:
## Chain 1: Elapsed Time: 0.138 seconds (Warm-up)
## Chain 1: 0.103 seconds (Sampling)
## Chain 1: 0.241 seconds (Total)
## Chain 1:
##
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 2).
## Chain 2:
## Chain 2: Gradient evaluation took 7e-06 seconds
## Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.07 seconds.
## Chain 2: Adjust your expectations accordingly!
## Chain 2:
## Chain 2:
## Chain 2: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 2: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 2: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 2: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 2: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 2: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 2: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 2: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 2: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 2: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 2: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 2: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 2:
## Chain 2: Elapsed Time: 0.148 seconds (Warm-up)
## Chain 2: 0.086 seconds (Sampling)
## Chain 2: 0.234 seconds (Total)
## Chain 2:
##
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 3).
## Chain 3:
## Chain 3: Gradient evaluation took 7e-06 seconds
## Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.07 seconds.
## Chain 3: Adjust your expectations accordingly!
## Chain 3:
## Chain 3:
## Chain 3: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 3: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 3: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 3: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 3: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 3: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 3: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 3: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 3: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 3: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 3: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 3: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 3:
## Chain 3: Elapsed Time: 0.14 seconds (Warm-up)
## Chain 3: 0.096 seconds (Sampling)
## Chain 3: 0.236 seconds (Total)
## Chain 3:
##
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 4).
## Chain 4:
## Chain 4: Gradient evaluation took 7e-06 seconds
## Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.07 seconds.
## Chain 4: Adjust your expectations accordingly!
## Chain 4:
## Chain 4:
## Chain 4: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 4: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 4: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 4: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 4: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 4: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 4: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 4: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 4: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 4: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 4: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 4: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 4:
## Chain 4: Elapsed Time: 0.14 seconds (Warm-up)
## Chain 4: 0.108 seconds (Sampling)
## Chain 4: 0.248 seconds (Total)
## Chain 4:
## 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).
## Chain 1:
## Chain 1: Gradient evaluation took 1.2e-05 seconds
## Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.12 seconds.
## Chain 1: Adjust your expectations accordingly!
## Chain 1:
## Chain 1:
## Chain 1: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 1: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 1: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 1: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 1: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 1: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 1: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 1: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 1: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 1: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 1: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 1: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 1:
## Chain 1: Elapsed Time: 0.211 seconds (Warm-up)
## Chain 1: 0.148 seconds (Sampling)
## Chain 1: 0.359 seconds (Total)
## Chain 1:
##
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 2).
## Chain 2:
## Chain 2: Gradient evaluation took 7e-06 seconds
## Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.07 seconds.
## Chain 2: Adjust your expectations accordingly!
## Chain 2:
## Chain 2:
## Chain 2: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 2: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 2: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 2: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 2: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 2: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 2: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 2: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 2: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 2: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 2: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 2: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 2:
## Chain 2: Elapsed Time: 0.23 seconds (Warm-up)
## Chain 2: 0.26 seconds (Sampling)
## Chain 2: 0.49 seconds (Total)
## Chain 2:
##
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 3).
## Chain 3:
## Chain 3: Gradient evaluation took 7e-06 seconds
## Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.07 seconds.
## Chain 3: Adjust your expectations accordingly!
## Chain 3:
## Chain 3:
## Chain 3: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 3: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 3: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 3: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 3: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 3: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 3: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 3: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 3: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 3: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 3: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 3: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 3:
## Chain 3: Elapsed Time: 0.214 seconds (Warm-up)
## Chain 3: 0.147 seconds (Sampling)
## Chain 3: 0.361 seconds (Total)
## Chain 3:
##
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 4).
## Chain 4:
## Chain 4: Gradient evaluation took 7e-06 seconds
## Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.07 seconds.
## Chain 4: Adjust your expectations accordingly!
## Chain 4:
## Chain 4:
## Chain 4: Iteration: 1 / 4000 [ 0%] (Warmup)
## Chain 4: Iteration: 400 / 4000 [ 10%] (Warmup)
## Chain 4: Iteration: 800 / 4000 [ 20%] (Warmup)
## Chain 4: Iteration: 1200 / 4000 [ 30%] (Warmup)
## Chain 4: Iteration: 1600 / 4000 [ 40%] (Warmup)
## Chain 4: Iteration: 2000 / 4000 [ 50%] (Warmup)
## Chain 4: Iteration: 2001 / 4000 [ 50%] (Sampling)
## Chain 4: Iteration: 2400 / 4000 [ 60%] (Sampling)
## Chain 4: Iteration: 2800 / 4000 [ 70%] (Sampling)
## Chain 4: Iteration: 3200 / 4000 [ 80%] (Sampling)
## Chain 4: Iteration: 3600 / 4000 [ 90%] (Sampling)
## Chain 4: Iteration: 4000 / 4000 [100%] (Sampling)
## Chain 4:
## Chain 4: Elapsed Time: 0.193 seconds (Warm-up)
## Chain 4: 0.142 seconds (Sampling)
## Chain 4: 0.335 seconds (Total)
## Chain 4:
## Warning: There were 2 divergent transitions after warmup. See
## https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
## to find out why this is a problem and how to eliminate them.
## 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.
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.
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 ProbLT0
## 1 Subgroup 1 -0.404 0.094 -0.592 -0.466 -0.403 -0.342 -0.221 1
## 2 Subgroup 2 -0.381 0.087 -0.549 -0.439 -0.382 -0.322 -0.21 1
## 3 Subgroup 3 -0.487 0.131 -0.737 -0.574 -0.488 -0.397 -0.229 1
## 4 Subgroup 4 -0.463 0.124 -0.706 -0.547 -0.464 -0.381 -0.223 1
## 5 Subgroup 5 -0.065 0.133 -0.322 -0.153 -0.065 0.024 0.2 0.691
## 6 Subgroup 6 -0.042 0.119 -0.275 -0.12 -0.041 0.036 0.195 0.643
## 7 Subgroup 7 -0.147 0.16 -0.463 -0.257 -0.146 -0.037 0.162 0.82
## 8 Subgroup 8 -0.124 0.147 -0.409 -0.223 -0.124 -0.025 0.162 0.801
## 9 No subgroup effect(1) -0.321 0.056 -0.434 -0.359 -0.321 -0.284 -0.212 1
## Subgroup Mean SD Q025 Q25 Median Q75 Q975 ProbLT0
## 1 Subgroup 1 -0.352 0.094 -0.544 -0.413 -0.349 -0.289 -0.171 1
## 2 Subgroup 2 -0.332 0.088 -0.513 -0.389 -0.332 -0.275 -0.163 1
## 3 Subgroup 3 -0.518 0.186 -0.925 -0.638 -0.496 -0.372 -0.225 1
## 4 Subgroup 4 -0.347 0.126 -0.622 -0.423 -0.342 -0.267 -0.1 0.997
## 5 Subgroup 5 -0.148 0.181 -0.43 -0.286 -0.173 -0.029 0.252 0.79
## 6 Subgroup 6 -0.264 0.126 -0.497 -0.347 -0.273 -0.185 0.004 0.973
## 7 Subgroup 7 -0.168 0.212 -0.49 -0.317 -0.209 -0.048 0.331 0.806
## 8 Subgroup 8 -0.181 0.196 -0.49 -0.318 -0.215 -0.068 0.269 0.824
## 9 No subgroup effect(1) -0.321 0.056 -0.434 -0.359 -0.321 -0.284 -0.212 1
Posterior subgroup treatment effect can be compared between subgroups by functions bzSummaryComp, bzPlotComp and bzForestComp.
## Comparison Mean SD Q025 Q25 Median Q75 Q975 ProbLT0
## 1 Subgroup 4-1 -0.058 0.157 -0.362 -0.166 -0.058 0.047 0.251 0.646
## 2 Subgroup 5-1 0.337 0.163 0.018 0.228 0.335 0.446 0.662 0.018
## 3 Subgroup 5-4 0.4 0.181 0.043 0.281 0.399 0.522 0.753 0.014
## Comparison Mean SD Q025 Q25 Median Q75 Q975 ProbLT0
## 1 Subgroup 4-1 0.002 0.158 -0.324 -0.098 0.006 0.107 0.302 0.483
## 2 Subgroup 5-1 0.206 0.206 -0.147 0.056 0.186 0.337 0.649 0.154
## 3 Subgroup 5-4 0.2 0.224 -0.198 0.039 0.181 0.344 0.678 0.188
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);
## Warning: Accessing looic using '$' is deprecated and will be removed in a
## future release. Please extract the looic estimate from the 'estimates'
## component instead.
## Warning: Accessing looic using '$' is deprecated and will be removed in a
## future release. Please extract the looic estimate from the 'estimates'
## component instead.
## Warning: Accessing looic using '$' is deprecated and will be removed in a
## future release. Please extract the looic estimate from the 'estimates'
## component instead.
## Model Subgroup lvef sodium any.vasodilator.use Mean
## Subgroup 1 No subgroup effect 1 0 0 0 -0.321
## Subgroup 2 No subgroup effect 2 0 0 1 -0.321
## Subgroup 3 No subgroup effect 3 0 1 0 -0.321
## Subgroup 4 No subgroup effect 4 0 1 1 -0.321
## Subgroup 5 No subgroup effect 5 1 0 0 -0.321
## Subgroup 6 No subgroup effect 6 1 0 1 -0.321
## Subgroup 7 No subgroup effect 7 1 1 0 -0.321
## Subgroup 8 No subgroup effect 8 1 1 1 -0.321
## SD Prob < 0
## Subgroup 1 0.056 1
## Subgroup 2 0.056 1
## Subgroup 3 0.056 1
## Subgroup 4 0.056 1
## Subgroup 5 0.056 1
## Subgroup 6 0.056 1
## Subgroup 7 0.056 1
## Subgroup 8 0.056 1
Function bzPredSubgrp generates the predictive distribution of the subgrooup treatment effects.
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] -0.5068202 -0.3186755 -0.66151839 -0.6706970 0.0349651 0.03565394
## [2,] -0.3238708 -0.4664452 -0.34268062 -0.2356906 0.1718492 -0.29755118
## [3,] -0.4385314 -0.4722072 -0.57918822 -0.8949619 0.3873833 -0.05029030
## [4,] -0.2040883 -0.5623868 -0.03214471 -0.7533808 0.2852018 0.52784411
## [5,] -0.4830247 -0.5726610 -0.29242328 -0.4500062 -0.2034257 -0.03134467
## [6,] -0.4403943 -0.2355878 -0.94915992 -0.1071810 -0.1239324 -0.08522230
## [,7] [,8]
## [1,] -0.27917849 -0.98750937
## [2,] 0.02195137 0.05579943
## [3,] -0.63001496 -0.33873624
## [4,] 0.69016994 0.58014914
## [5,] -0.44378895 -0.02106578
## [6,] -0.22918635 0.11023730
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
Package beanz provides function bzGailSimon that implements the Gail-Simon test for qualitative interactions:
## [1] 0.9191656
The result show that there is no significant qualitative interactions according to the Gail-Simon test.