#
# Calculate odds ratio and confidence interval for a single study
#
metabin(10, 20, 15, 20, sm = "OR")
#
# Different results (due to handling of studies with double zeros)
#
metabin(0, 10, 0, 10, sm = "OR")
metabin(0, 10, 0, 10, sm = "OR", allstudies = TRUE)
#
# Use subset of Olkin (1995) to conduct meta-analysis based on inverse
# variance method (with risk ratio as summary measure)
#
data(Olkin95)
meta1 <- metabin(event.e, n.e, event.c, n.c,
data = Olkin95, subset = c(41, 47, 51, 59),
method = "Inverse")
summary(meta1)
funnel(meta1)
#
# Use different subset of Olkin (1995)
#
meta2 <- metabin(event.e, n.e, event.c, n.c,
data = Olkin95, subset = Olkin95$year < 1970,
method = "Inverse", studlab = author)
summary(meta2)
forest(meta2)
#
# Meta-analysis with odds ratio as summary measure
#
meta3 <- metabin(event.e, n.e, event.c, n.c,
data = Olkin95, subset = Olkin95$year < 1970,
sm = "OR", method = "Inverse", studlab = author)
# Same meta-analysis result using 'update.meta' function
meta3 <- update(meta2, sm = "OR")
summary(meta3)
#
# Meta-analysis based on Mantel-Haenszel method
# (with odds ratio as summary measure)
#
meta4 <- update(meta3, method = "MH")
summary(meta4)
#
# Meta-analysis based on Peto method
# (only available for odds ratio as summary measure)
#
meta5 <- update(meta3, method = "Peto")
summary(meta5)
#
# Meta-analysis using generalised linear mixed models
# (only if R packages 'metafor' and 'lme4' are available)
#
if (suppressMessages(require(metafor, quietly = TRUE, warn = FALSE)) &
require(lme4, quietly = TRUE)) {
#
# Logistic regression model with (k = 4) fixed study effects
# (default: model.glmm = "UM.FS")
#
meta6 <- metabin(event.e, n.e, event.c, n.c,
data = Olkin95, subset = Olkin95$year < 1970,
method = "GLMM")
# Same results:
meta6 <- update(meta2, method = "GLMM")
summary(meta6)
#
# Mixed-effects logistic regression model with random study effects
# (warning message printed due to argument 'nAGQ')
#
meta7 <- update(meta6, model.glmm = "UM.RS")
#
# Use additional argument 'nAGQ' for internal call of 'rma.glmm' function
#
meta7 <- update(meta6, model.glmm = "UM.RS", nAGQ = 1)
summary(meta7)
#
# Generalised linear mixed model (conditional Hypergeometric-Normal)
# (R package 'BiasedUrn' must be available)
#
if (require(BiasedUrn, quietly = TRUE)) {
meta8 <- update(meta6, model.glmm = "CM.EL")
summary(meta8)
}
#
# Generalised linear mixed model (conditional Binomial-Normal)
#
meta9 <- update(meta6, model.glmm = "CM.AL")
summary(meta9)
#
# Logistic regression model with (k = 70) fixed study effects
# (about 18 seconds with Intel Core i7-3667U, 2.0GHz)
#
meta10 <- metabin(event.e, n.e, event.c, n.c,
data = Olkin95, method = "GLMM")
summary(meta10)
#
# Mixed-effects logistic regression model with random study effects
# - about 50 seconds with Intel Core i7-3667U, 2.0GHz
# - several warning messages, e.g. "failure to converge, ..."
#
summary(update(meta10, model.glmm = "UM.RS"))
#
# Conditional Hypergeometric-Normal GLMM
# - long computation time (about 12 minutes with Intel Core i7-3667U, 2.0GHz)
# - estimation problems for this very large dataset:
# * warning that Choleski factorization of Hessian failed
# * confidence interval for treatment effect smaller in random
# effects model compared to fixed effect model
#
if (require(BiasedUrn, quietly = TRUE)) {
system.time(meta11 <- update(meta10, model.glmm = "CM.EL"))
summary(meta11)
}
#
# Generalised linear mixed model (conditional Binomial-Normal)
# (less than 1 second with Intel Core i7-3667U, 2.0GHz)
#
summary(update(meta10, model.glmm = "CM.AL"))
}
Run the code above in your browser using DataLab