Learn R Programming

beanz (version 3.1)

bzCallStan: Call STAN models

Description

Call STAN to draw posterior samples for Bayesian HTE models.

Usage

bzCallStan(
  mdls = c("nse", "fs", "sr", "bs", "srs", "ds", "eds"),
  dat.sub,
  var.estvar,
  var.cov,
  par.pri = c(B = 1000, C = 1000, D = 1, MU = 0),
  var.nom = NULL,
  delta = 0,
  prior.sig = 1,
  chains = 4,
  ...
)

Value

A class beanz.stan list containing

mdl

name of the Bayesian HTE model

stan.rst

raw rstan sampling results

smps

matrix of the posterior samples

get.mus

method to return the posterior sample of the subgroup treatment effects

DIC

DIC value

looic

leave-one-out cross-validation information criterion

rhat

Gelman and Rubin potential scale reduction statistic

prior.sig

option for the informative prior on \(\sigma_g\)

delta

parameter for specifying the informative priors of \(\sigma_g\)

Arguments

mdls

name of the Bayesian HTE model. The options are:

nse

No subgroup effect model

fs

Full stratification model

sr

Simple regression model

bs

Basic shrinkage model

srs

Simple regression with shrinkage model

ds

Dixon-Simon model

eds

Extended Dixon-Simon model

dat.sub

dataset with subgroup treatment effect summary data

var.estvar

column names in dat.sub that corresponds to treatment effect estimation and the estimated variance

var.cov

array of column names in dat.sub that corresponds to binary or ordinal baseline covariates

par.pri

vector of prior parameters for each model. See beanz-package for the details of model specification.

nse, fs

B

sr

B, C

bs, ds, eds

B, D

srs

B, C, D

nse, fs, sr, bs, srs, ds, eds

MU

var.nom

array of column names in dat.sub that corresponds to nominal baseline covariates

delta

parameter for specifying the informative priors of \(\sigma_g\)

prior.sig

option for the informative prior on \(\sigma_g\). 0: uniform prior and 1: log-normal prior

chains

STAN options. Number of chains.

...

options to call STAN sampling. These options include iter, warmup, thin, algorithm. See rstan::sampling for details.

Examples

Run this code
if (FALSE) {
var.cov    <- c("sodium", "lvef", "any.vasodilator.use");
var.resp   <- "y";
var.trt    <- "trt";
var.censor <- "censor";
resptype   <- "survival";
var.estvar <- c("Estimate", "Variance");

subgrp.effect <- bzGetSubgrpRaw(solvd.sub,
                                  var.resp   = var.resp,
                                  var.trt    = var.trt,
                                  var.cov    = var.cov,
                                  var.censor = var.censor,
                                  resptype   = resptype);

rst.nse    <- bzCallStan("nse", dat.sub=subgrp.effect,
                         var.estvar = var.estvar, var.cov = var.cov,
                         par.pri = c(B=1000, MU = 0),
                         chains=4, iter=600,
                         warmup=200, thin=2, seed=1000);

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=600,
                        warmup=200, thin=2, seed=1000);}

Run the code above in your browser using DataLab