The metafor Package

A Meta-Analysis Package for R

User Tools

Site Tools


Package Features

Below is an overview of the various features provided by the metafor package. Where applicable, function names are also indicated.

Effect Size and Outcome Measures

The package allows the user to calculate various effect size and outcome measures frequently used in meta-analyses (escalc() function), including:

  • risk differences, risk ratios, and odds ratios for 2×2 table data,
  • incidence rate ratios and differences for two-group person-time data,
  • raw and standardized mean differences and response ratios (ratios of means),
  • raw and Fisher's r-to-z transformed correlation coefficients,
  • raw, log, logit, arcsine, and Freeman-Tukey double arcsine transformed proportions,
  • raw, log, and square-root transformed incidence rates,
  • raw means, mean changes, and standardized mean changes,
  • raw and transformed Cronbach's alpha values.

Models and Analysis Approaches

The package provides a variety of models and analysis approaches, including:

  • fixed-, random-, and mixed-effects models using the inverse-variance method (rma() function),
  • Mantel-Haenszel and Peto's (one-step) method for 2×2 table and two-group person-time data ( and rma.peto() functions),
  • generalized linear (mixed-effects) models (i.e., mixed-effects (conditional) logistic and Poisson regression models) for the analysis of 2×2 table data, two-group person-time data, proportions, and incidence rates (rma.glmm() function),
  • models for multilevel and multivariate meta-analyses ( function),
  • models for network meta-analyses and mixed treatment comparisons ( function),
  • phylogenetic meta-analysis ( function),
  • subgrouping and (mixed-effects) meta-regression analyses,
  • models with user-defined weights.

Plots and Figures

The package provides functions for creating a variety of meta-analytic plots and figures, including:

  • forest plots (forest() function),
  • funnel plots (funnel() function),
  • radial (Galbraith) plots (radial() function),
  • Baujat plots (baujat() function),
  • GOSH plots (gosh() function),
  • normal quantile-quantile (QQ) plots (qqnorm() function),
  • L'Abbé plots (labbe() function).

R itself also provides extensive and very flexible graphing and plotting capabilities that can be easily adapted to create further plots and figures.

Publication Bias

The presence of publication bias (or more accurately, funnel plot asymmetry or "small-study effects") and its potential impact on the results can be examined via a variety of methods, including:

  • the rank correlation test (ranktest() function),
  • Egger's regression test (regtest() function),
  • the trim and fill method (trimfill() function),
  • the Henmi and Copas approach (hc() function),
  • a file drawer analysis (fail-safe N computation) using the Rosenthal, Orwin, and Rosenberg methods (fsn() function).

Inference Methods

The package provides standard and advanced methods for drawing inferences based on meta-analytic data and for assessing the model fit, including:

  • fitted and predicted outcomes (fitted() and predict() functions),
  • best linear unbiased predictions (blup() function),
  • improved tests/confidence intervals using the Knapp and Hartung method,
  • permutation tests (permutest() function),
  • likelihood ratio tests (anova() function),
  • (cluster) robust tests and confidence intervals (robust() function),
  • model fit criteria (logLik() and deviance() functions),
  • information criteria (AIC(), BIC(), and fitstats() functions),
  • cumulative meta-analysis (cumul() function).

Outlier and Influence Diagnostics

Various methods are available to identify outliers and/or influential studies, and for conducting sensitivity analyses, including:

  • raw/standardized/studentized residuals (residuals(), rstandard(), and rstudent() functions),
  • DFFITS values, Cook's distances, covariance ratios, and DFBETAS values (influence() function),
  • leave-one-out analyses (leave1out() and influence() functions),
  • model weights and hat values (weights() and hatvalues() functions).

A diagram showing the various functions in the metafor package (and how they related to each other) can be found here. If the package is installed, you should also be able to open this diagram directly from R with the command vignette("metafor_diagram").

The metafor package is a work in progress and is updated on a regular basis with new functions and options. Under the log of package updates, you can see what changes/updates have been made to the package over the years.

features.txt · Last modified: 2016/05/15 15:04 by Wolfgang Viechtbauer