SimPower: power in designing a new cluster randomized trial with the...

Description Usage Arguments Value Examples

Description

SimPower returns power in designing a new cluster randomized trial with the power prior method

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
SimPower(family, to.do.option, cSet, cNarmVar = "narm",
  cNcluster.armVar = "ncluster.arm", cNpat.clusterVar = "npat.cluster",
  cBtwVar = "sigma.b", cWthVar = "sigma.e", cTrtVecVar, hSet = NULL,
  hNarmVar = "narm", hNpat.armVar = "npat.arm", hWthVar = "sigma.e",
  hTrtVecVar = NULL, hData = NULL, hTrtVar = "x", hOutcomeVar = "y",
  hSumVar = "n", cRdmSeed.init = 0, hRdmSeed.init = 0, weight = "asym",
  cover.level = 0.95, nchain = 1, niter = 2000, nburnin = 1000,
  nthin = 1, file.dir.init = tempdir(), cfile.name = "cmodelfile",
  hfile.name = "hmodelfile", pprfile.name = "pprmodelfile",
  graphics.name = "graphics", file.rm = T, OpenBUGS.dir = NULL,
  OpenBUGS.seed = 1, Rep = 1, num.core = parallel::detectCores(logical =
  F) - 1)

Arguments

family

outcome distribution.

to.do.option

a value in 'sim_power', 'sim_SSD' and 'real_SSD'.

cSet

current trial setting. It should be a list.

cNarmVar

the variable name of arm in current trial.

cNcluster.armVar

the variable name of total clusters in each arm in current trial. Its default value is 'ncluster.arm'.

cNpat.clusterVar

the variable name of total patients in each cluster in current trial. Its default value is 'npat.cluster'.

cBtwVar

the variable name of between cluster variation in current trial.

cWthVar

the variable name of within cluster variation in current trial.

cTrtVecVar

the variable name of treatment in current trial. It should be in the order of first treatment, second treatment until the last one.

hSet

historical trial setting. It should be in a list. It is NULL by default.

hNarmVar

the variable name of arm in historical trial.

hNpat.armVar

the variable name of total patients in each arm in historical trial. Its default value is 'npat.arm'.

hWthVar

the variable name of within cluster variation in historical trial.

hTrtVecVar

the variable name of treatment in historical trial. It should be in the order of first treatment, second treatment until the last one.

hData

Real historical trial data. It is NULL by default.

hTrtVar

the variable name of treatment in historical trial data.

hOutcomeVar

the variable name of outcome in historical trial data.

hSumVar

the variable name of total observation in historical trial data.

cRdmSeed.init

the initial value of random seed to generate current trial data.

hRdmSeed.init

the initial value of random seed to generate historical trial data.

weight

discounting parameter. It is 'asym' by default.

cover.level

nomial coverage level of HPD interval.

nchain

number of mcmc chains to run.

niter

length of mcmc chains.

nburnin

length of burnin of mcmc chains.

nthin

thinning rate of mcmc chain.

file.dir.init

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

cfile.name

the file name of current BUGS model.

hfile.name

the file name of historical BUGS model.

pprfile.name

the file name of power prior BUGS model.

graphics.name

the file name of mcmc convergence graphics.

file.rm

whether to remove all files after Bayesian computations are done.

OpenBUGS.dir

directory to install OpenBUGS package.

OpenBUGS.seed

the random number generator state of OpenBUGS.

Rep

number of replications to determine power.

num.core

number of cores for parallel computation.

Value

power in designing a new cluster randomized trial with the power prior method

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
#### SSD with simulated historical data;
my.curset <- list(narm=2,ncluster.arm=rep(10,2),npat.cluster=rep(20,20),
'trt1'=-0.1,'trt2 v.s. trt1'=log(4),sigma.b=1)
my.histset <- list(narm=2,npat.arm=rep(200,2),'trt1'=0.1,'trt2 v.s. trt1'=log(4))
mypower <- SimPower(family='binomial', to.do.option='sim_SSD', cSet=my.curset,
cTrtVecVar=c('trt1','trt2 v.s. trt1'), hSet=my.histset,
hTrtVecVar=c('trt1','trt2 v.s. trt1'),
weight="asym",nchain=2,niter=500,nburnin=100,nthin=5,Rep=1,num.core=3,file.rm=T,
OpenBUGS.dir="C:\\Program Files (x86)\\OpenBUGS\\OpenBUGS323\\OpenBUGS.exe",
OpenBUGS.seed=12)
 #### SSD with real historical data;
my.curset <- list(narm=2,ncluster.arm=rep(10,2),npat.cluster=rep(20,20),
'trt1'=-0.1,'trt2 v.s. trt1'=log(4),sigma.b=1)
my.histdata <- data.frame(x=c(1,2),y=c(10,15),n=c(20,20))
mypower <- SimPower(family='binomial', to.do.option='real_SSD',cSet=my.curset,
cTrtVecVar=c('trt1','trt2 v.s. trt1'),hData=my.histdata,weight='sym',
nchain=2,niter=500,nburnin=100,nthin=5,file.rm=T, Rep=4,num.core=2,
OpenBUGS.dir="C:\\Program Files (x86)\\OpenBUGS\\OpenBUGS323\\OpenBUGS.exe")

## End(Not run)

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