data("HinksEtAl2010")
if (FALSE) {
# perform meta analysis based on weakly informative half-normal prior:
bma01 <- bayesmeta(y = HinksEtAl2010$log.or,
sigma = HinksEtAl2010$log.or.se,
labels = HinksEtAl2010$study,
tau.prior = function(t){dhalfnormal(t,scale=1.0)})
# perform meta analysis based on slightly more informative half-normal prior:
bma02 <- bayesmeta(y = HinksEtAl2010$log.or,
sigma = HinksEtAl2010$log.or.se,
labels = HinksEtAl2010$study,
tau.prior = function(t){dhalfnormal(t,scale=0.5)})
# show heterogeneity posteriors:
par(mfrow=c(2,1))
plot(bma01, which=4, prior=TRUE, taulim=c(0,1))
plot(bma02, which=4, prior=TRUE, taulim=c(0,1))
par(mfrow=c(1,1))
# show heterogeneity estimates:
rbind("half-normal(1.0)"=bma01$summary[,"tau"],
"half-normal(0.5)"=bma02$summary[,"tau"])
# show q-profile confidence interval for tau in comparison:
require("metafor")
ma03 <- rma.uni(yi=log.or, sei=log.or.se, slab=study, data=HinksEtAl2010)
confint(ma03)$random["tau",c("ci.lb","ci.ub")]
# show I2 values in the relevant range:
tau <- seq(0, 0.7, by=0.1)
cbind("tau"=tau,
"I2" =bma01$I2(tau=tau))
# show effect estimates:
round(rbind("half-normal(1.0)" = bma01$summary[,"mu"],
"half-normal(0.5)" = bma02$summary[,"mu"]), 5)
# show forest plot:
forestplot(bma02)
# show shrinkage estimates:
bma02$theta
}
Run the code above in your browser using DataLab