Table 4

WinBUGS codes for performing random effects meta-analysis and meta-analysis incorporating observational data

Random effects meta-analysisInformative prior with observational data
Model†model {
for (i in 1:N)
{
P[i]<-1/V[i] Y[i]∼dnorm(delta[i], P[i]) delta[i]∼dnorm(d, prec) OR[i]<-exp(delta[i])
} d∼dnorm(0, 1.0E-5) OR[13]<-exp(d) tau∼dunif(0,10) tau.sq<-tau*tau prec<-1/tau.sq
}
model {
# (1) create multiple datasets
for (i in 1:5) {
for (k in 1:12) {
rc[i, k]<- rc.dat[i] rt[i, k]<-rt.dat[i] nc[i, k]<-nc.dat[i] nt[i, k]<-nt.dat[i] }
}
# (2) estimate RCT meta-analysis model for each value of data
for (k in 1:12) {
for (i in 1:5) {
rc[i,k]∼dbin(pc[i,k], nc[i,k])
rt[i,k]∼dbin(pt[i,k], nt[i,k]) logit(pc[i,k])<-mu[i,k]
logit(pt[i,k])<-mu[i,k]+delta[i,k]
mu[i,k]∼dnorm(0.0, 1.0E-6)
delta[i,k]∼dnorm(d[k], prec[k])
or[i,k]<-exp(delta[i,k])
}
d[k]∼dnorm(0.33, prec.d[k])
OR[k]<-exp(d[k])
prec[k]<-1/tau.sq[k]
tau.sq[k]<-tau[k]*tau[k]
tau[k]∼dunif(0,5)
}
# (3) calculate precision of prior (from meta-analysis of obs studies) downweighted using alpha
for (k in 1:12) {
prec.d[k]<-alpha[k]*271.3
}
}
Data‡list(Y=c(-0.51083, -0.73397, -0.24846, -0.15082, -0.54473, -0.52763, -0.36817, -0.13926, -0.75502, -0.27444, -0.26136),
V=c(1.706611, 0.01954, 0.035483, 0.021832, 0.010326, 0.033478, 0.011817, 0.005765, 0.089499, 0.004559, 0.022782),
N=11)
list(rt.dat=c(0,2,3,2,3),
nt.dat=c(67,45,34,56,34),
rc.dat=c(2,3,4,2,0),
nc.dat=c(44,56,78,123,35),
alpha=c(0.0001, 0.2, 0.8)
)
Initials§list(
d = 472.0235128342391,
delta = c(
470.6994400270435, 472.3980455275865, 472.201137881263, 472.0198057372273, 471.8605396435204,
470.2850099832592, 469.5829735618464, 473.0258057826344, 470.3932238143316, 469.5792223324207,
469.6419041364815),
tau = 0.8303798133648838)


list(
d = 0,
delta = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
tau = 1)
list(d = c(0,0,0),
delta = structure(.Data = c(**place 5*12=60 initial values here**),
.Dim = c(5,12)),
mu = structure(.Data = c(**place 5*12=60 initial values here**),
.Dim = c(5,12)),
tau = c(1,1,1,1,1,1,1,1,1,1,1,1)
)
  • †Contents following # are not syntax used for analysis, but are used to annotate corresponding codes.

  • ‡Data are used for illustration purpose and are not obtained from the real analysis.

  • §Initial values are randomly generated and do not represent the actual values used in analysis.