# load data:
data("BucherEtAl1997")
# show data:
head(BucherEtAl1997)
if (FALSE) {
# compute effect sizes (log-ORs for pairwise comparisons)
# from the count data:
es <- escalc(measure="OR",
ai=events.A, n1i=total.A, # "exposure group"
ci=events.B, n2i=total.B, # "control group"
slab=study, data=BucherEtAl1997)
# specify regressor matrix:
X <- cbind("TMP.DP" = rep(c(1, 0, 1), c(8,5,9)),
"AP.DP" = rep(c(0, 1,-1), c(8,5,9)))
# perform Bayesian meta-regression:
bmr01 <- bmr(es, X=X)
# show default output:
print(bmr01)
# specify contrast matrix:
contrastX <- rbind("TMP-SMX vs. D/P"=c(1,0),
"AP vs. D/P" =c(0,1),
"TMP-SMX vs. AP" =c(1,-1))
# show summary including contrast estimates:
summary(bmr01, X.mean=contrastX)
# show forest plot including contrast estimates:
forestplot(bmr01, X.mean=contrastX, xlab="log-OR")
# perform frequentist meta-regression:
fmr01 <- rma(es, mods=X, intercept=FALSE)
print(fmr01)
# compare Bayesian and frequentist results;
# estimated log-OR for "TMP-SMX" vs. "D/P"
rbind("bayesmeta"=bmr01$summary[c("mean","sd"),"TMP.DP"],
"rma" =c(fmr01$beta["TMP.DP",], fmr01$se[1]))
# estimated log-OR for "AP" vs. "D/P"
rbind("bayesmeta"=bmr01$summary[c("mean","sd"),"AP.DP"],
"rma" =c(fmr01$beta["AP.DP",], fmr01$se[2]))
# estimated heterogeneity:
rbind("bayesmeta"=bmr01$summary["median","tau"],
"rma" =sqrt(fmr01$tau2))
}
Run the code above in your browser using DataLab