Calculation of common effect and random effects estimates for meta-analyses with correlations; inverse variance weighting is used for pooling.

```
metacor(
cor,
n,
studlab,
data = NULL,
subset = NULL,
exclude = NULL,
cluster = NULL,
sm = gs("smcor"),
level = gs("level"),
common = gs("common"),
random = gs("random") | !is.null(tau.preset),
overall = common | random,
overall.hetstat = common | random,
prediction = gs("prediction") | !missing(method.predict),
method.tau = gs("method.tau"),
method.tau.ci = gs("method.tau.ci"),
tau.preset = NULL,
TE.tau = NULL,
tau.common = gs("tau.common"),
level.ma = gs("level.ma"),
method.random.ci = gs("method.random.ci"),
adhoc.hakn.ci = gs("adhoc.hakn.ci"),
level.predict = gs("level.predict"),
method.predict = gs("method.predict"),
adhoc.hakn.pi = gs("adhoc.hakn.pi"),
seed.predict = NULL,
null.effect = 0,
method.bias = gs("method.bias"),
backtransf = gs("backtransf"),
text.common = gs("text.common"),
text.random = gs("text.random"),
text.predict = gs("text.predict"),
text.w.common = gs("text.w.common"),
text.w.random = gs("text.w.random"),
title = gs("title"),
complab = gs("complab"),
outclab = "",
subgroup,
subgroup.name = NULL,
print.subgroup.name = gs("print.subgroup.name"),
sep.subgroup = gs("sep.subgroup"),
test.subgroup = gs("test.subgroup"),
prediction.subgroup = gs("prediction.subgroup"),
seed.predict.subgroup = NULL,
byvar,
adhoc.hakn,
keepdata = gs("keepdata"),
warn.deprecated = gs("warn.deprecated"),
control = NULL,
...
)
```

An object of class `c("metacor", "meta")`

with corresponding
generic functions (see `meta-object`

).

- cor
Correlation.

- n
Number of observations.

- studlab
An optional vector with study labels.

- data
An optional data frame containing the study information, i.e., cor and n.

- subset
An optional vector specifying a subset of studies to be used.

- exclude
An optional vector specifying studies to exclude from meta-analysis, however, to include in printouts and forest plots.

- cluster
An optional vector specifying which estimates come from the same cluster resulting in the use of a three-level meta-analysis model.

- sm
A character string indicating which summary measure (

`"ZCOR"`

or`"COR"`

) is to be used for pooling of studies.- level
The level used to calculate confidence intervals for individual studies.

- common
A logical indicating whether a common effect meta-analysis should be conducted.

- random
A logical indicating whether a random effects meta-analysis should be conducted.

- overall
A logical indicating whether overall summaries should be reported. This argument is useful in a meta-analysis with subgroups if overall results should not be reported.

- overall.hetstat
A logical value indicating whether to print heterogeneity measures for overall treatment comparisons. This argument is useful in a meta-analysis with subgroups if heterogeneity statistics should only be printed on subgroup level.

- prediction
A logical indicating whether a prediction interval should be printed.

- method.tau
A character string indicating which method is used to estimate the between-study variance \(\tau^2\) and its square root \(\tau\) (see

`meta-package`

).- method.tau.ci
A character string indicating which method is used to estimate the confidence interval of \(\tau^2\) and \(\tau\) (see

`meta-package`

).- tau.preset
Prespecified value for the square root of the between-study variance \(\tau^2\).

- TE.tau
Overall treatment effect used to estimate the between-study variance tau-squared.

- tau.common
A logical indicating whether tau-squared should be the same across subgroups.

- level.ma
The level used to calculate confidence intervals for meta-analysis estimates.

- method.random.ci
A character string indicating which method is used to calculate confidence interval and test statistic for random effects estimate (see

`meta-package`

).- adhoc.hakn.ci
A character string indicating whether an

*ad hoc*variance correction should be applied in the case of an arbitrarily small Hartung-Knapp variance estimate (see`meta-package`

).- level.predict
The level used to calculate prediction interval for a new study.

- method.predict
A character string indicating which method is used to calculate a prediction interval (see

`meta-package`

).- adhoc.hakn.pi
A character string indicating whether an

*ad hoc*variance correction should be applied for prediction interval (see`meta-package`

).- seed.predict
A numeric value used as seed to calculate bootstrap prediction interval (see

`meta-package`

).- null.effect
A numeric value specifying the effect under the null hypothesis.

- method.bias
A character string indicating which test is to be used. Either

`"Begg"`

,`"Egger"`

, or`"Thompson"`

, can be abbreviated. See function`metabias`

.- backtransf
A logical indicating whether results for Fisher's z transformed correlations (

`sm = "ZCOR"`

) should be back transformed in printouts and plots. If TRUE (default), results will be presented as correlations; otherwise Fisher's z transformed correlations will be shown.- text.common
A character string used in printouts and forest plot to label the pooled common effect estimate.

- text.random
A character string used in printouts and forest plot to label the pooled random effects estimate.

- text.predict
A character string used in printouts and forest plot to label the prediction interval.

- text.w.common
A character string used to label weights of common effect model.

- text.w.random
A character string used to label weights of random effects model.

- title
Title of meta-analysis / systematic review.

- complab
Comparison label.

- outclab
Outcome label.

- subgroup
An optional vector to conduct a meta-analysis with subgroups.

- subgroup.name
A character string with a name for the subgroup variable.

- print.subgroup.name
A logical indicating whether the name of the subgroup variable should be printed in front of the group labels.

- sep.subgroup
A character string defining the separator between name of subgroup variable and subgroup label.

- test.subgroup
A logical value indicating whether to print results of test for subgroup differences.

- prediction.subgroup
A logical indicating whether prediction intervals should be printed for subgroups.

- seed.predict.subgroup
A numeric vector providing seeds to calculate bootstrap prediction intervals within subgroups. Must be of same length as the number of subgroups.

- byvar
Deprecated argument (replaced by 'subgroup').

- adhoc.hakn
Deprecated argument (replaced by 'adhoc.hakn.ci').

- keepdata
A logical indicating whether original data (set) should be kept in meta object.

- warn.deprecated
A logical indicating whether warnings should be printed if deprecated arguments are used.

- control
An optional list to control the iterative process to estimate the between-study variance \(\tau^2\). This argument is passed on to

`rma.uni`

.- ...
Additional arguments (to catch deprecated arguments).

Guido Schwarzer guido.schwarzer@uniklinik-freiburg.de

Common effect and random effects meta-analysis of correlations based
either on Fisher's z transformation of correlations (```
sm =
"ZCOR"
```

) or direct combination of (untransformed) correlations
(`sm = "COR"`

) (see Cooper et al., p264-5 and p273-4). Only
few statisticians would advocate the use of untransformed
correlations unless sample sizes are very large (see Cooper et al.,
p265). The artificial example given below shows that the smallest
study gets the largest weight if correlations are combined directly
because the correlation is closest to 1.

A three-level random effects meta-analysis model (Van den Noortgate
et al., 2013) is utilized if argument `cluster`

is used and at
least one cluster provides more than one estimate. Internally,
`rma.mv`

is called to conduct the analysis and
`weights.rma.mv`

with argument ```
type =
"rowsum"
```

is used to calculate random effects weights.

Default settings are utilised for several arguments (assignments
using `gs`

function). These defaults can be changed for
the current R session using the `settings.meta`

function.

Furthermore, R function `update.meta`

can be used to
rerun a meta-analysis with different settings.

Argument `subgroup`

can be used to conduct subgroup analysis for
a categorical covariate. The `metareg`

function can be
used instead for more than one categorical covariate or continuous
covariates.

Arguments `subset`

and `exclude`

can be used to exclude
studies from the meta-analysis. Studies are removed completely from
the meta-analysis using argument `subset`

, while excluded
studies are shown in printouts and forest plots using argument
`exclude`

(see Examples in `metagen`

).
Meta-analysis results are the same for both arguments.

Internally, both common effect and random effects models are
calculated regardless of values choosen for arguments
`common`

and `random`

. Accordingly, the estimate
for the random effects model can be extracted from component
`TE.random`

of an object of class `"meta"`

even if
argument `random = FALSE`

. However, all functions in R
package **meta** will adequately consider the values for
`common`

and `random`

. E.g. functions
`print.meta`

and `forest.meta`

will not
print results for the random effects model if ```
random =
FALSE
```

.

A prediction interval will only be shown if ```
prediction =
TRUE
```

.

Cooper H, Hedges LV, Valentine JC (2009):
*The Handbook of Research Synthesis and Meta-Analysis*,
2nd Edition.
New York: Russell Sage Foundation

Van den Noortgate W, López-López JA, Marín-Martínez F, Sánchez-Meca J (2013):
Three-level meta-analysis of dependent effect sizes.
*Behavior Research Methods*,
**45**, 576--94

`meta-package`

, `update.meta`

,
`metacont`

, `metagen`

,
`print.meta`

```
m1 <- metacor(c(0.85, 0.7, 0.95), c(20, 40, 10))
# Print correlations (back transformed from Fisher's z
# transformation)
#
m1
# Print Fisher's z transformed correlations
#
print(m1, backtransf = FALSE)
# Forest plot with back transformed correlations
#
forest(m1)
# Forest plot with Fisher's z transformed correlations
#
forest(m1, backtransf = FALSE)
m2 <- update(m1, sm = "cor")
m2
if (FALSE) {
# Identical forest plots (as back transformation is the identity
# transformation)
forest(m2)
forest(m2, backtransf = FALSE)
}
```

Run the code above in your browser using DataCamp Workspace