pprmodelBUGS: power prior method analysis

Description Usage Arguments Value Examples

View source: R/pprmodelBUGS.R

Description

pprmodelBUGS returns a pprMod object, including the posterior samples of the treatment effect, the corresponding summary results and convergence diagnostic results

Usage

1
2
3
4
5
6
pprmodelBUGS(cData, cForm, hData, hForm, weight, file.dir = tempdir(),
  cfile.name = "cmodelfile", hfile.name = "hmodelfile",
  pprfile.name = "pprmodelfile", graphics.name = "graphics", file.rm = F,
  OpenBUGS.dir = NULL, OpenBUGS.seed = 1, family, nchain = 1,
  niter = 2000, nburnin = base::floor(niter/2), nthin = 1,
  cover.level = 0.95)

Arguments

cData

current trial data. It should be in data frame.

cForm

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

hData

historical trial data. It should be in data frame.

hForm

model for historical trial data. It should be a formula object.

weight

discounting parameter. It should be a value between 0 and 1, or a character 'asym' or 'sym'.

file.dir

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

cfile.name

the file name of curent trial BUGS model.

hfile.name

the file name of historical trial BUGS model.

pprfile.name

the file name of power prior BUGS model.

graphics.name

the file name of the MCMC diagnostic graphics file.

file.rm

whether to remove all files after all computations are done.

OpenBUGS.dir

directory to install OpenBUGS package.

OpenBUGS.seed

the 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.

cover.level

nominal coverage level of the HPD interval

Value

The posterior samples of treatment effect

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
### gaussian data;
my.cData <- data.frame(cl=rep(1:20,each=50),
x=c(rep(1,250),rep(2,250),rep(3,250),rep(4,250)), y=rnorm(1000,0,1))
my.hData <- data.frame(x=c(1,2,3,4),y=rnorm(4,0,1),n=rep(10,4))
my.pprobject <- pprmodelBUGS(cData=my.cData,cForm=y~x+(1|cl),
hData=my.hData,hForm=y|n ~ x,weight='sym',file.rm=F,OpenBUGS.seed=2,
family="gaussian",niter=5000,nburnin=2500,nthin=5,nchain=2,cover.level=0.95)
 ### binomial data;
my.cData <- data.frame(cl=rep(1:15,each=50),x=c(rep(1,250),
rep(2,250),rep(3,250)),y=rbinom(750,1,0.5))
my.hData <- data.frame(x=c(1,2,3),y=rbinom(3,50,0.5),n=rep(50,3))
my.pprobject <- pprmodelBUGS(cData=my.cData,cForm=y~x+(1|cl),
hData=my.hData,hForm=y|n ~ x,weight="sym",family="binomial",
niter=200,nburnin=50,nthin=1,nchain=1)

## End(Not run)

shanRpackage/pprincrt documentation built on June 4, 2018, 12:46 a.m.