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.

Calculation of Effect Sizes and Outcome Measures

The package allows the user to calculate various effect sizes 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),
  • the 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),
  • models for phylogenetic meta-analyses ( function),
  • spatio-temporal meta-analytic models ( 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:

  • funnel plots (funnel() function),
  • forest plots (forest() and addpoly() functions),
  • Baujat plots (baujat() function),
  • L'Abbé plots (labbe() function),
  • radial (Galbraith) plots (radial() function),
  • GOSH plots (gosh() function),
  • profile likelihood plots (profile() function),
  • normal quantile-quantile (QQ) plots (qqnorm() 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),
  • the test of excess significance (tes() 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:

  • likelihood ratio and Wald-type tests (anova() function),
  • confidence intervals for heterogeneity statistics (confint() function),
  • permutation tests (permutest() function),
  • (cluster) robust tests and confidence intervals (robust() function),
  • cumulative meta-analysis (cumul() function),
  • fitted and predicted outcomes (fitted() and predict() functions),
  • best linear unbiased predictions (ranef() and blup() functions),
  • improved tests/confidence intervals using the Knapp and Hartung method,
  • model fit criteria (logLik() and deviance() functions),
  • information criteria (AIC(), BIC(), and fitstats() functions),
  • simulation of data from a fitted model (simulate() function).

The package is also compatible with the glmulti and MuMIn packages for model selection and (multi)model inference (see here for an illustration), the boot package for bootstrapping (see here for an illustration), and the mice and Amelia packages for multiple imputation (see here for an illustration).

Outlier/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),
  • model weights and hat values (weights() and hatvalues() functions),
  • leave-one-out analyses (leave1out() and influence() functions).


The package also includes over 40 datasets from published meta-analyses that can be used for teaching and illustration purposes.


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("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: 2020/08/18 19:51 by Wolfgang Viechtbauer