Function to fit the Bayesian fixed and randomeffects metaanalytic models with or without moderators. Models are designed to include noninformative priors.
1 2 3 4 5 6 7 8 9 10 11 12  bmeta(data, outcome = c("bin", "ctns", "count"), model = c("std.norm",
"std.dt", "reg.norm", "reg.dt", "std.ta", "std.mv", "reg.ta", "reg.mv", "std",
"std.unif", "std.hc", "reg", "reg.unif", "reg.hc"), type = c("fix", "ran"),
n.iter = 10000, n.burnin = 5000, n.samples = 1000, n.chains = 2,
model.file = "model.txt")
## Default S3 method:
bmeta(data, outcome = c("bin", "ctns", "count"), model = c("std.norm",
"std.dt", "reg.norm", "reg.dt", "std.ta", "std.mv", "reg.ta", "reg.mv", "std",
"std.unif", "std.hc", "reg", "reg.unif", "reg.hc"), type = c("fix", "ran"),
n.iter = 10000, n.burnin = 5000, n.samples = 1000, n.chains = 2,
model.file = "model.txt")

data 
a data list containing information on observed data (including moderators). See 'details'. 
outcome 
type of outcome that needs to be specified. For binary, continuous and count data,

model 
type of model that needs to be specified. See 'details'. 
type 
model type—either fixedeffects ( 
n.iter 
number of iterations to be used in the simulation (default is 10000) 
n.burnin 
number of burnin to be used in the simulation (default is 5000) 
n.samples 
The total number of MCMC simulations saved (including thinning). Default at 1000 
n.chains 
number of Markov chains to be used in the simulation (default is 2) 
model.file 
Name of the text file to which the model is saved 
Specifying the data
The function can be used to evaluate odds ratios (or log odds ratios), mean difference and incidence rate ratios (or log incidence rate ratios). Users need to specify a list of data to be used in the function. For binary data, events out of case and control arm and sample size of case and control arm need to be listed. For continuous data, mean and standard errors of case and control arm need to be listed if information is available. However, if only mean difference and variance can be retrieved from each study, users need to list mean difference and precision (inverse of variance). Notice that information of all the studies need to be provided in the same format for the function to work properly. For example, the function cannot work if some of the studies provide mean and standard errors of the two arms while the rest studies provide mean difference and variance. For count data, total number of events in the followup period of case and control arm, total followup persontime in case and control arm should be listed.
If additional impacts of a variable or more than one variable are observed (when metaregression is expected to be used), users need to provide a matrix with each column either containing a dummy variable or a continuous variable. In case that categorical variables (i.e. ethnicity, age band) are observed and included, users need to first choose a 'baseline' category as reference and then create dummies for each of the rest categories.
Model selection
Apart from 'null' models which apply Bayesian methods to obtain studyspecific without poolingeffects, there are 22 models included in this package for pooling studyspecific estimates together and producing summary estimate. The number of models designed for binary, continuous and count data are 8, 8 and 6, respectively. The model selection process for binary and count data requires users to specify not only whether metaanalysis or metaregression is wanted but also the priors to be used.
For binary data, normal and Student tdistribution priors for summary estimates (on log
scale) can be selected and it is indicated that Student tdistribution has heavier tails
and is therefore more robust to outliers. The argument 'model' here includes 4 options
— std.norm
, std.dt
, reg.norm
, reg.dt
.
For continuous data, rather than specifying prior, users need to select whether all
studies included report mean and standard errors of two arms separately or only mean
difference and variance as discussed above in the 'Specifying the data' section. The
argument 'model' here includes 4 options— std.ta
, std.mv
, reg.ta
,
reg.mv
('model' ending with 'ta' represents 'two arms' and ending with 'mv'
represents 'mean and variance').
For count data, uniform and halfCauchy distribution priors for the variability of
summary estimates (on log scale) can be selected. It is suggested that halfCauchy
distribution has heavier tails and allows for outliers and accommodates small variances
closing to zero. It should be noticed that there is no need to specify priors for
fixedeffects models for count data. The argument 'model' here includes 6 options
— std
, std.unif
, std.hc
, reg
, reg.unif
,
reg.hc
.
In conjunction with the argument 'type'— fix
or ran
, users can select
the specific model wanted for a certain type of data.
mod 
A 
params 
a list of monitored parameters to be saved 
data 
the original dataset 
inits 
a list with 
outcome 
selected type of outcome (i.e. bin/ctns/count) 
type 
selected type of model (either fixed/randomeffects) 
model 
selected model with specific priors 
mod0 
independent model without pooling effects 
Tao Ding Gianluca Baio
Baio, G.(2012) Bayesian methods in health economics. Chapman Hall, CRC.
Welton, N.J., Sutton, A.J., Cooper, N., Abrams, K.R. & Ades, A.E. (2012) Evidence synthesis for decision making in healthcare. Chichester, UK: John Wiley & Sons, Ltd.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56  ### Read and format the data (binary)
data = read.csv(url("http://www.statistica.it/gianluca/bmeta/Databin.csv"))
### List data for binary outcome (for metaanalysis)
d1 < data.list < list(y0=data$y0,y1=data$y1,n0=data$n0,n1=data$n1)
### List data for binary outcome when there is a covariate (for metaregression)
d1 < data.list < list(y0=data$y0,y1=data$y1,n0=data$n0,n1=data$n1,X=cbind(data$X0))
### Select fixedeffects metaanalysis with normal prior for binary data
m1 < bmeta(d1, outcome="bin", model="std.norm", type="fix",n.iter=100)
### Select randomeffects metaregression with tdistribution prior for binary
### data
m2 < bmeta(data.list, outcome="bin", model="reg.dt", type="ran",n.iter=100)
### Read and format the data (continuous)
data = read.csv(url("http://www.statistica.it/gianluca/bmeta/Datactns.csv"))
### List data for continuous outcome for studies reporting two arms separately
### (for metaanalysis)
d1 < data.list < list(y0=data$y0,y1=data$y1,se0=data$se0,se1=data$se1)
### List data for continuous outcome for studies reporting mean difference and
### variance with a covariate (for metaregression)
d2 < data.list2 < list(y=data$y,prec=data$prec,X=cbind(data$X0))
### Select fixedeffects metaanalysis with studies reporting information of
### both arm for continuous data
m1 < bmeta(data.list, outcome="ctns", model="std.ta", type="fix",n.iter=100)
### Select randomeffects metaregression with studies reporting mean difference and
### variance only for continuous data
m2 < bmeta(data.list2, outcome="ctns", model="reg.mv", type="ran",n.iter=100)
### Read and format the data (count)
data = read.csv(url("http://www.statistica.it/gianluca/bmeta/Datacount.csv"))
### List data for count outcome (for metaanalysis)
d1 < data.list < list(y0=data$y0,y1=data$y1,p0=data[,6],p1=data[,10])
### List data for count outcome when there is a covariate (for metaregression)
d2 < data.list < list(y0=data$y0,y1=data$y1,p0=data[,6],p1=data[,10],X=cbind(data$X0))
### Select fixedeffects metaanalysis for count data
m1 < bmeta(d1, outcome="count", model="std", type="fix",n.iter=100)
### Select randomeffects metaanalysis with halfCauchy prior for count data
m2 < bmeta(d1, outcome="count", model="std.hc", type="ran",n.iter=100)
### Select randomeffects metaregression with uniform prior for count data
m3 < bmeta(d2, outcome="count", model="reg.unif", type="ran",n.iter=100)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.