metareg: Meta-regression

View source: R/metareg.R

metareg.metaR Documentation

Meta-regression

Description

Meta-regression for objects of class meta. This is a wrapper function for the R functions rma.uni, rma.glmm, and rma.mv in the R package metafor (Viechtbauer 2010).

Usage

## S3 method for class 'meta'
metareg(
  x,
  formula,
  method.tau = x$method.tau,
  method.random.ci = x$method.random.ci,
  level.ma = x$level.ma,
  intercept = TRUE,
  hakn = method.random.ci == "HK",
  ...
)

metareg(x, ...)

## Default S3 method:
metareg(x, ...)

Arguments

x

An object of class meta.

formula

Either a character string or a formula object.

method.tau

A character string indicating which method is used to estimate the between-study variance tau-squared. Either "FE", "DL", "REML", "ML", "HS", "SJ", "HE", or "EB", can be abbreviated.

method.random.ci

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

level.ma

The level used to calculate confidence intervals for parameter estimates in the meta-regression model.

intercept

A logical indicating whether an intercept should be included in the meta-regression model.

hakn

Deprecated argument (replaced by 'method.random.ci').

...

Additional arguments passed to R function rma.uni, rma.glmm, and rma.mv.

Details

This R function is a wrapper function for R functions rma.uni, rma.glmm, and rma.mv in the R package metafor (Viechtbauer 2010).

If argument method.random.ci is a vector, only the first element is considered as the R functions in metafor expect a single method.

Note, results are not back-transformed in printouts of meta-analyses using summary measures with transformations, e.g., log risk ratios are printed instead of the risk ratio if argument sm = "RR" and logit transformed proportions are printed if argument sm = "PLOGIT".

Argument '...' can be used to pass additional arguments to R functions rma.uni, rma.glmm, and rma.mv. For example, argument control to provide a list of control values for the iterative estimation algorithm. See help page of R functions rma.uni, rma.glmm, and rma.mv, for more details.

Value

An object of class c("metareg", "rma"). Please look at the help pages of R functions rma.uni, rma.glmm, and rma.mv for more details on the output from these functions.

In addition, a list .meta is added to the output containing the following components:

x, formula, method.tau, method.random.ci, hakn, level.ma, intercept

As defined above.

dots

Information provided in argument '...'.

call

Function call.

version

Version of R package meta used to create object.

version.metafor

Version of R package metafor used to create object.

Author(s)

Guido Schwarzer guido.schwarzer@uniklinik-freiburg.de

References

Viechtbauer W (2010): Conducting Meta-Analyses in R with the Metafor Package. Journal of Statistical Software, 36, 1–48

See Also

bubble, summary.meta, metagen

Examples

data(Fleiss1993cont)
# Add some (fictitious) grouping variables:
Fleiss1993cont$age <- c(55, 65, 55, 65, 55)
Fleiss1993cont$region <- c("Europe", "Europe", "Asia", "Asia", "Europe")

ma1 <- metacont(n.psyc, mean.psyc, sd.psyc, n.cont, mean.cont, sd.cont,
  data = Fleiss1993cont, sm = "SMD")
## Not run: 
# Warning as no information on covariate is available
#
metareg(ma1)

## End(Not run)

# Do meta-regression for covariate region
#
ma2 <- update(ma1, subgroup = region, tau.common = TRUE, common = FALSE)
metareg(ma2)

# Same result for
# - tau-squared
# - test of heterogeneity
# - test for subgroup differences
# (as argument 'tau.common' was used to create ma2)
#
ma2
metareg(ma2, intercept = FALSE)
metareg(ma1, region)

# Different result for
# - tau-squared
# - test of heterogeneity
# - test for subgroup differences
# (as argument 'tau.common' is - by default - FALSE)
#
ma3 <- update(ma1, subgroup = region)
ma3

# Generate bubble plot
#
bubble(metareg(ma2))

# Do meta-regression with two covariates
#
metareg(ma3, region + age)

# Do same meta-regressions using formula notation
#
metareg(ma1, ~ region)
metareg(ma3, ~ region + age)

# Print intermediate results for iterative estimation algorithm;
# furthermore print results with three digits.
#
metareg(ma3, region, control = list(verbose = TRUE), digits = 3)


meta documentation built on Nov. 14, 2026, 5:09 p.m.