metamerge  R Documentation 
This function can be used to merge results of two metaanalyses
into a single metaanalysis object if they are based on the same
data set. This is, for example, useful to produce a forest plot of
a randomeffects metaanalysis with different estimates of the
betweenstudy variance \tau^2
.
metamerge(
meta1,
meta2,
common1 = meta1$common,
random1 = meta1$random,
prediction1 = meta1$prediction,
common2 = meta2$common,
random2 = meta2$random,
prediction2 = meta2$prediction,
label1 = NULL,
label2 = NULL,
label1.common = label1,
label2.common = label2,
label1.random = label1,
label2.random = label2,
label1.predict = label1,
label2.predict = label2,
label1.subgroup = label1,
label2.subgroup = label2,
hetlabel1 = label1.random,
hetlabel2 = label2.random,
taulabel1 = label1.random,
taulabel2 = label2.random,
text.pooled1 = NULL,
text.pooled2 = NULL,
text.w.pooled1 = NULL,
text.w.pooled2 = NULL,
text.common1 = text.pooled1,
text.common2 = text.pooled2,
text.random1 = text.pooled1,
text.random2 = text.pooled2,
text.predict1 = text.pooled1,
text.predict2 = text.pooled2,
text.w.common1 = text.w.pooled1,
text.w.common2 = text.w.pooled2,
text.w.random1 = text.w.pooled1,
text.w.random2 = text.w.pooled2,
keep = FALSE,
keep.Q = keep,
keep.I2 = keep.Q,
keep.w = keep,
common = common1  common2,
random = random1  random2,
overall = common  random,
overall.hetstat = common  random,
prediction = prediction1  prediction2,
backtransf,
warn.deprecated = gs("warn.deprecated"),
pooled1,
pooled2
)
meta1 
First metaanalysis object (see Details). 
meta2 
Second metaanalysis object (see Details). 
common1 
A logical indicating whether results of common effect model should be considered for first metaanalysis. 
random1 
A logical indicating whether results of random effects model should be considered for first metaanalysis. 
prediction1 
A logical indicating whether prediction interval should be considered for first metaanalysis. 
common2 
A logical indicating whether results of common effect model should be considered for second metaanalysis. 
random2 
A logical indicating whether results of random effects model should be considered for second metaanalysis. 
prediction2 
A logical indicating whether prediction interval should be considered for second metaanalysis. 
label1 
Default setting for arguments 'label1.common', 'label1.random', 'label1.predict' and 'label1.subgroup'. 
label2 
Default setting for arguments 'label2.common', 'label2.random', 'label2.predict' and 'label2.subgroup'. 
label1.common 
A character string ... 
label2.common 
A character string ... 
label1.random 
A character string ... (default label for arguments 'hetlabel1' and 'taulabel1'). 
label2.random 
A character string ... (default label for arguments 'hetlabel2' and 'taulabel2'). 
label1.predict 
A character string ... 
label2.predict 
A character string ... 
label1.subgroup 
A character string ... 
label2.subgroup 
A character string ... 
hetlabel1 
A character string used to label heterogeneity statistics of the first metaanalysis. 
hetlabel2 
A character string used to label heterogeneity statistics of the second metaanalysis. 
taulabel1 
A character string used to label estimate of betweenstudy variance of the first metaanalysis. 
taulabel2 
A character string used to label estimate of betweenstudy variance of the second metaanalysis. 
text.pooled1 
A character string used in printouts and forest plot to label the results from the first metaanalysis. 
text.pooled2 
A character string used in printouts and forest plot to label the results from the second metaanalysis. 
text.w.pooled1 
A character string used to label weights of
the first metaanalysis; can be of same length as the number of
pooled estimates requested in argument 
text.w.pooled2 
A character string used to label weights of
the second metaanalysis; can be of same length as the number of
pooled estimates requested in argument 
text.common1 
A character string used in printouts and forest plot to label results for common effect models from the first metaanalysis. 
text.common2 
A character string used in printouts and forest plot to label results for common effect models from the second metaanalysis. 
text.random1 
A character string used in printouts and forest plot to label results for random effects models from the first metaanalysis. 
text.random2 
A character string used in printouts and forest plot to label results for random effects models from the second metaanalysis. 
text.predict1 
A character string used in printouts and forest plot to label prediction interval from the first metaanalysis. 
text.predict2 
A character string used in printouts and forest plot to label prediction interval from the second metaanalysis. 
text.w.common1 
A character string used to label common effect weights of the first metaanalysis; can be of same length as the number of common effect estimates. 
text.w.common2 
A character string used to label common effect weights of the second metaanalysis; can be of same length as the number of common effect estimates. 
text.w.random1 
A character string used to label random effects weights of the first metaanalysis; can be of same length as the number of random effects estimates. 
text.w.random2 
A character string used to label random effects weights of the second metaanalysis; can be of same length as the number of random effects estimates. 
keep 
A logical indicating whether to keep additional information from second metaanalysis. 
keep.Q 
A logical indicating whether heterogeneity statistic Q of second metaanalysis should be kept or ignored. 
keep.I2 
A logical indicating whether heterogeneity statistic I2 of second metaanalysis should be kept or ignored. 
keep.w 
A logical indicating whether weights of the second metaanalysis should be kept or ignored. 
common 
A logical indicating whether results of common effect metaanalyses should be reported. 
random 
A logical indicating whether results of random effects metaanalyses should be reported. 
overall 
A logical indicating whether overall summaries should be reported. 
overall.hetstat 
A logical value indicating whether to print heterogeneity measures for overall treatment comparisons. 
prediction 
A logical indicating whether prediction intervals should be reported. 
backtransf 
A logical indicating whether results should be
back transformed in printouts and plots. If

warn.deprecated 
A logical indicating whether warnings should be printed if deprecated arguments are used. 
pooled1 
Deprecated argument (replaced by 'common1',
'random1', 'prediction1'). A character string indicating whether
results of common effect or random effects model should be
considered for first metaanalysis. Either 
pooled2 
Deprecated argument (replaced by 'common2',
'random2', 'prediction2'). A character string indicating whether
results of common effect or random effects model should be
considered for second metaanalysis. Either 
In R package meta, objects of class "meta"
contain
results of both common effect and random effects
metaanalyses. This function enables the user to merge the results
of two metaanalysis object if they are based on the same data set.
Applications of this function include printing and plotting results of the common effect or random effects metaanalysis and the
trimandfill method (trimfill
),
limit metaanalyis (limitmeta
from R
package metasens),
Copas selection model (copas
from R
package metasens),
robust variance metaanalysis model
(robu
from R package robumeta).
The first argument (meta1
) must be an object created by a
metaanalysis function (see metaobject
). If an
object created with limitmeta
or
copas
is provided as the first argument,
this object will be returned, i.e., argument meta2
will be
ignored.
The second metaanalysis could be an object created by a
metaanalysis function or with trimfill
,
limitmeta
, copas
,
or robu
.
The created metaanalysis object only contains the study results,
i.e., estimated effects and confidence intervals, from the first
metaanalysis which are shown in printouts and forest plots. This
only makes a difference for metaanalysis methods where individual
study results differ, e.g., MantelHaenszel and Peto method for
binary outcomes (see metabin
).
R function metaadd
can be used to add pooled results
from any (external) metaanalysis.
R function metabind
can be used to print and plot the
results of several metaanalyses without the restriction that the
same data set has to be used. Accordingly, individual study results
are ignored.
An object of class "meta"
and "metamerge"
with
corresponding generic functions (see metaobject
).
The following list elements have a different meaning:
TE , seTE , studlab 
Treatment estimate, standard error, and study labels (first metaanalyis). 
lower , upper 
Lower and upper confidence interval limits for individual studies (first metaanalysis). 
statistic , pval 
Statistic and pvalue for test of treatment effect for individual studies (first metaanalysis. 
w.common 
Vector or matrix with common effect weights. 
w.random 
Vector or matrix with random effects weights. 
k 
Vector with number of estimates (same length as number of common effect and random effects estimates). 
k.study 
Vector with number of studies (same length as number of common effect and random effects estimates). 
k.all 
Vector with total number of studies (same length as number of common effect and random effects estimates). 
k.TE 
Vector with number of studies with estimable effects (same length as number of common effect and random effects estimates). 
k.MH 
Vector with number of studies combined with MantelHaenszel method (same length as number of common effect and random effects estimates). 
TE.common 
Vector with common effect estimates. 
seTE.common 
Vector with standard errors of common effect estimates. 
lower.common 
Vector with lower confidence limits (common effect model). 
upper.common 
Vector with upper confidence limits (common effect model). 
statistic.common 
Vector with test statistics for test of overall effect (common effect model). 
pval.common 
Vector with pvalue of test for overall effect (common effect model). 
TE.random 
Vector with random effects estimates. 
seTE.random 
Vector with standard errors of random effects estimates. 
lower.random 
Vector with lower confidence limits (random effects model). 
upper.random 
Vector with upper confidence limits (random effects model). 
statistic.random 
Vector with test statistics for test of overall effect (random effects model). 
pval.random 
Vector with pvalue of test for overall effect (random effects model). 
Furthermore, metaanalysis results of common effect or random
effects model are taken from first metaanalysis if only random
effects or common effects models are selected from both
metaanalyses (arguments pooled1
and pooled2
).
Guido Schwarzer guido.schwarzer@uniklinikfreiburg.de
metagen
, metabind
,
metaadd
# Print results with more significant digits and do not show confidence
# intervals for tau^2 and tau
oldset < settings.meta(digits = 6, digits.stat = 4, digits.pval = 6,
digits.Q = 6, digits.I2 = 4, digits.H = 4,
print.tau2.ci = FALSE, print.tau.ci = FALSE)
oldopts < options(width = 120)
data(Fleiss1993bin)
# MantelHaenszel method
m1 < metabin(d.asp, n.asp, d.plac, n.plac, data = Fleiss1993bin,
studlab = paste(study, year), sm = "OR")
# Peto method
m2 < update(m1, method = "Peto")
# Inverse variance method (only common effect model)
m3 < update(m2, method = "Inverse", random = FALSE)
# Merge results from MH and Peto method
#  show individual results for MH method
# (as this is the first metaanalysis)
#  keep all additional information from Peto metaanalysis (i.e.,
# weights, Q statistic and I2 statistic)
m12 < metamerge(m1, m2,
label1 = "REML", label2 = "REMLPeto",
label1.common = "MH", label2.common = "Peto",
text.common1 = "MantelHaenszel method",
text.common2 = "Peto method",
text.w.random1 = "REML", text.w.random2 = "REMLPeto",
hetlabel1 = "MH/IV", hetlabel2 = "Peto",
keep = TRUE)
# Add common effect results from inverse variance method
#  keep weights from IV metaanalysis
#  Q and I2 statistic are identical for sm = "MH" and sm = "Inverse"
# as inverse variance method is used for sm = "MH" under random
# effects model
m123 < metamerge(m12, m3,
label2 = "IV",
text.common2 = "Inverse variance method",
keep.w = TRUE)
summary(m123)
## Not run:
forest(m123, digits = 6)
# Merge results (show individual results for Peto method)
m21 < metamerge(m2, m1,
label1 = "REMLPeto", label2 = "REML",
label1.common = "Peto", label2.common = "MH",
hetlabel1 = "Peto", hetlabel2 = "MH/IV",
text.common1 = "Peto method",
text.common2 = "MantelHaenszel method",
keep = TRUE)
# Add results from inverse variance method
#  keep weights from IV metaanalysis
#  Q and I2 statistic are identical for sm = "MH" and sm = "Inverse"
# as inverse variance method is used for sm = "MH" under random
# effects model
m213 < metamerge(m21, m3,
label2 = "IV",
text.common2 = "Inverse variance method",
keep.w = TRUE)
summary(m213)
# Random effects method using ML estimator for betweenstudy variance tau2
m4 < update(m1, common = FALSE, method.tau = "ML")
# Use DerSimonianLaird estimator for tau2
m5 < update(m4, method.tau = "DL")
# Use PauleMandel estimator for tau2
m6 < update(m4, method.tau = "PM")
# Merge random effects results for ML and DL estimators
#  keep weights for DL estimator (which are different from ML)
m45 < metamerge(m4, m5, label1 = "ML", label2 = "DL",
text.w.random1 = "REML", text.w.random2 = "REDL", keep.w = TRUE)
summary(m45)
# Add results for PM estimator
#  keep weights
m456 < metamerge(m45, m6, label2 = "PM",
text.w.random2 = "REPM", keep.w = TRUE)
summary(m456)
m123456 < metamerge(m123, m456)
m123456
# Use HartungKnapp confidence intervals
#  do not keep information on Q, I2 and weights
m7 < update(m4, method.random.ci = "HK",
text.random = "HartungKnapp method")
m8 < update(m5, method.random.ci = "HK",
text.random = "HartungKnapp method")
m9 < update(m6, method.random.ci = "HK",
text.random = "HartungKnapp method")
# Merge results for HartungKnapp method (with REML and DL estimator)
#  RE weights for REML estimator are shown
m78 < metamerge(m7, m8, label1 = "ML", label2 = "DL")
summary(m78)
m789 < metamerge(m78, m9, label2 = "PM")
summary(m789)
# Merge everything
m1to9 < metamerge(metamerge(m123, m456, keep.w = TRUE), m789)
summary(m1to9)
m10 < update(m1, method = "GLMM")
m.all < metamerge(m1to9, m10, keep.Q = TRUE,
label2 = "GLMM", taulabel2 = "MLGLMM")
summary(m.all)
forest(m.all, layout = "JAMA")
forest(m.all, details = TRUE)
## End(Not run)
settings.meta(oldset)
options(oldopts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.