## Loading required package: beanz
## Loading required package: Rcpp
## Loading required package: rstan
## Loading required package: ggplot2
## Loading required package: StanHeaders
## rstan (Version 2.15.1, packaged: 2017-04-19 05:03:57 UTC, GitRev: 2e1f913d3ca3)
## For execution on a local, multicore CPU with excess RAM we recommend calling
## rstan_options(auto_write = TRUE)
## options(mc.cores = parallel::detectCores())
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).
##
## Gradient evaluation took 2.7e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.27 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.167974 seconds (Warm-up)
## 0.093903 seconds (Sampling)
## 0.261877 seconds (Total)
##
##
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 2).
##
## Gradient evaluation took 9e-06 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.09 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.167242 seconds (Warm-up)
## 0.092886 seconds (Sampling)
## 0.260128 seconds (Total)
##
##
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 3).
##
## Gradient evaluation took 9e-06 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.09 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.165667 seconds (Warm-up)
## 0.091546 seconds (Sampling)
## 0.257213 seconds (Total)
##
##
## SAMPLING FOR MODEL 'nse' NOW (CHAIN 4).
##
## Gradient evaluation took 8e-06 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.08 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.178436 seconds (Warm-up)
## 0.092313 seconds (Sampling)
## 0.270749 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 4.4e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.44 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.247333 seconds (Warm-up)
## 0.286079 seconds (Sampling)
## 0.533412 seconds (Total)
##
##
## SAMPLING FOR MODEL 'sr' NOW (CHAIN 2).
##
## 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.243427 seconds (Warm-up)
## 0.308797 seconds (Sampling)
## 0.552224 seconds (Total)
##
##
## SAMPLING FOR MODEL 'sr' 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.238348 seconds (Warm-up)
## 0.23667 seconds (Sampling)
## 0.475018 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.238924 seconds (Warm-up)
## 0.254751 seconds (Sampling)
## 0.493675 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 1.8e-05 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 0.18 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.356533 seconds (Warm-up)
## 0.274975 seconds (Sampling)
## 0.631508 seconds (Total)
##
##
## SAMPLING FOR MODEL 'bs' NOW (CHAIN 2).
##
## 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.362117 seconds (Warm-up)
## 0.424137 seconds (Sampling)
## 0.786254 seconds (Total)
##
##
## SAMPLING FOR MODEL 'bs' 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.332777 seconds (Warm-up)
## 0.239403 seconds (Sampling)
## 0.57218 seconds (Total)
##
##
## SAMPLING FOR MODEL 'bs' 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.347662 seconds (Warm-up)
## 0.23494 seconds (Sampling)
## 0.582602 seconds (Total)
## Warning: There were 15 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.
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 2.5%
## Subgroup 1 "Subgroup 1" "-0.401" "0.095" "-0.586"
## Subgroup 2 "Subgroup 2" "-0.381" "0.087" "-0.555"
## Subgroup 3 "Subgroup 3" "-0.488" "0.134" "-0.748"
## Subgroup 4 "Subgroup 4" "-0.468" "0.128" "-0.717"
## Subgroup 5 "Subgroup 5" "-0.061" "0.136" "-0.327"
## Subgroup 6 "Subgroup 6" "-0.041" "0.122" "-0.282"
## Subgroup 7 "Subgroup 7" "-0.148" "0.161" "-0.465"
## Subgroup 8 "Subgroup 8" "-0.128" "0.149" "-0.419"
## No subgroup effect(1) "No subgroup effect(1)" "-0.322" "0.057" "-0.433"
## 25% Median 75% 97.5% Prob<0
## Subgroup 1 "-0.465" "-0.399" "-0.338" "-0.212" "1"
## Subgroup 2 "-0.44" "-0.38" "-0.321" "-0.208" "1"
## Subgroup 3 "-0.579" "-0.487" "-0.398" "-0.223" "1"
## Subgroup 4 "-0.552" "-0.47" "-0.382" "-0.219" "1"
## Subgroup 5 "-0.154" "-0.061" "0.028" "0.206" "0.678"
## Subgroup 6 "-0.123" "-0.04" "0.041" "0.195" "0.63"
## Subgroup 7 "-0.256" "-0.147" "-0.04" "0.17" "0.822"
## Subgroup 8 "-0.228" "-0.128" "-0.03" "0.168" "0.808"
## No subgroup effect(1) "-0.36" "-0.322" "-0.284" "-0.21" "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);
tbl.sub <- bzSummary(rst.bs, ref.stan.rst=rst.nse, ref.sel.grps=1);
print(tbl.sub);
## Subgroup Mean SD 2.5%
## Subgroup 1 "Subgroup 1" "-0.352" "0.095" "-0.549"
## Subgroup 2 "Subgroup 2" "-0.333" "0.087" "-0.506"
## Subgroup 3 "Subgroup 3" "-0.519" "0.186" "-0.925"
## Subgroup 4 "Subgroup 4" "-0.346" "0.131" "-0.623"
## Subgroup 5 "Subgroup 5" "-0.145" "0.182" "-0.432"
## Subgroup 6 "Subgroup 6" "-0.268" "0.124" "-0.497"
## Subgroup 7 "Subgroup 7" "-0.167" "0.22" "-0.507"
## Subgroup 8 "Subgroup 8" "-0.18" "0.194" "-0.488"
## No subgroup effect(1) "No subgroup effect(1)" "-0.322" "0.057" "-0.433"
## 25% Median 75% 97.5% Prob<0
## Subgroup 1 "-0.413" "-0.349" "-0.288" "-0.17" "1"
## Subgroup 2 "-0.392" "-0.333" "-0.276" "-0.163" "1"
## Subgroup 3 "-0.645" "-0.494" "-0.377" "-0.23" "1"
## Subgroup 4 "-0.425" "-0.343" "-0.264" "-0.088" "0.994"
## Subgroup 5 "-0.281" "-0.168" "-0.028" "0.253" "0.789"
## Subgroup 6 "-0.352" "-0.276" "-0.191" "-0.003" "0.976"
## Subgroup 7 "-0.32" "-0.208" "-0.042" "0.357" "0.797"
## Subgroup 8 "-0.318" "-0.213" "-0.066" "0.269" "0.825"
## No subgroup effect(1) "-0.36" "-0.322" "-0.284" "-0.21" "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 can be compared between subgroups by functions bzSummaryComp, bzPlotComp and bzForestComp.
tbl.sub <- bzSummaryComp(rst.sr, sel.grps=sel.grps);
print(tbl.sub);
## Comparison Mean SD 2.5% 25% Median
## Subgroup 4-1 "Subgroup 4-1" "-0.065" "0.16" "-0.373" "-0.173" "-0.067"
## Subgroup 5-1 "Subgroup 5-1" "0.342" "0.166" "0.014" "0.229" "0.341"
## Subgroup 5-4 "Subgroup 5-4" "0.402" "0.187" "0.039" "0.275" "0.401"
## 75% 97.5% Prob<0
## Subgroup 4-1 "0.039" "0.257" "0.66"
## Subgroup 5-1 "0.456" "0.665" "0.021"
## Subgroup 5-4 "0.527" "0.77" "0.014"
bzPlot(rst.sr, sel.grps = sel.grps);
bzForest(rst.sr, sel.grps = sel.grps);
tbl.sub <- bzSummaryComp(rst.bs, sel.grps=sel.grps);
print(tbl.sub);
## Comparison Mean SD 2.5% 25% Median
## Subgroup 4-1 "Subgroup 4-1" "0.007" "0.163" "-0.321" "-0.098" "0.008"
## Subgroup 5-1 "Subgroup 5-1" "0.211" "0.204" "-0.141" "0.068" "0.192"
## Subgroup 5-4 "Subgroup 5-4" "0.203" "0.223" "-0.19" "0.045" "0.186"
## 75% 97.5% Prob<0
## Subgroup 4-1 "0.112" "0.33" "0.479"
## Subgroup 5-1 "0.341" "0.646" "0.146"
## Subgroup 5-4 "0.349" "0.674" "0.183"
bzPlotComp(rst.bs, sel.grps = sel.grps);
bzForestComp(rst.bs, sel.grps = sel.grps);
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
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.3679054 -0.3782405 -0.7620150 -0.4232232 -0.206226512 -0.35257540
## [2,] -0.1439333 -0.2500721 -0.7967529 -0.4537728 -0.001736849 0.06923540
## [3,] -0.3236505 -0.3712093 -0.8635390 -0.5477005 0.358020477 0.10117516
## [4,] -0.3213348 -0.3705808 -0.8180419 -0.6458409 0.181075442 -0.30552695
## [5,] -0.4113384 -0.4913849 -0.5326650 -0.4327768 -0.080489285 -0.33270577
## [6,] -0.4260798 -0.3386668 -0.3084879 -0.5029305 -0.243726118 -0.02523631
## [,7] [,8]
## [1,] 0.16467848 -0.28605772
## [2,] -0.06369855 -0.06154876
## [3,] -0.70238718 0.43730160
## [4,] -0.29786883 -0.85778738
## [5,] -0.32543661 -0.30975903
## [6,] 0.02236187 -0.88973919
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();
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.