cmodelBUGS: Bayesian mixed model analysis of current trial data

Description Usage Arguments Value Examples

Description

cmodelBUGS returns posterior samples of treatment effect

Usage

1
2
cmodelBUGS(cData, cForm, file.dir, file.name, file.rm = F, OpenBUGS.dir,
  OpenBUGS.seed = 1, family, nchain, niter, nburnin, nthin)

Arguments

cData

current trial data. It should be in a data frame.

cForm

model for current trial data. It should be in a formula object.

file.dir

directory to save model BUGS file and input and output files of OpenBUGS.

file.name

the name of the model BUGS file.

file.rm

whether to remove all files after Bayesian computations are done.

OpenBUGS.dir

directory to install OpenBUGS package.

OpenBUGS.seed

random number generator state of OpenBUGS.

family

outcome distribution.

nchain

number of MCMC chains.

niter

length of MCMC chain.

nburnin

burnin period of MCMC chain.

nthin

thinning rate of MCMC chain.

Value

The posterior samples of treatment effect

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
  ### my current data;
my.cData <- data.frame(cl=rep(1:10,each=50),y=rbinom(500,1,0.5),x=c(rep(1,250),rep(2,250)))

my.csample <- cmodelBUGS(cData=my.cData,cForm=y ~ x + (1|cl),
file.dir=tempdir(),file.name='cmodelfile',file.rm=T,
OpenBUGS.dir="C:/Program Files (x86)/OpenBUGS/OpenBUGS323/OpenBUGS.exe",
family="binomial",nchain=2,niter=500,nburnin=50,nthin=5)

## End(Not run)

shanRpackage/pprincrt documentation built on May 23, 2019, 1:11 p.m.