ipd.run {bipd}R Documentation

Run the model using the ipd object

Description

This is the core function that runs the model in our program. Before running this function, we need to specify data, prior, JAGS code, etc. using ipd.model type function.

Usage

ipd.run(
  ipd,
  pars.save = NULL,
  inits = NULL,
  n.chains = 3,
  n.adapt = 1000,
  n.burnin = 1000,
  n.iter = 10000
)

Arguments

ipd

ipd object created from ipd.model type function

pars.save

parameters to save. For instance, "beta" - coefficients for main effects; "gamma" - coefficients for effect modifiers; "delta" - average treatment effect

inits

initial values specified for the parameters to save

n.chains

number of MCMC chains to sample

n.adapt

number of iterations for adaptation (Note that the samples from adaptation phase is non-Markovian and do not constitute a Markov chain)

n.burnin

number of iterations for burn-in

n.iter

number of iterations to run after the adaptation

Value

MCMC samples stored using JAGS. The returned samples have the form of mcmc.list and coda functions can be directly applied.

Examples

ds <- generate_ipdma_example(type = "continuous")
ipd <- with(ds, ipdma.model.onestage(y = y, study = studyid, treat = treat, X = cbind(z1, z2), 
response = "normal", shrinkage = "none"))

samples <- ipd.run(ipd, n.chains = 3, n.burnin = 500, n.iter = 5000)


[Package bipd version 0.3 Index]