The metafor Package

A Meta-Analysis Package for R

User Tools

Site Tools


features

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,
  • point-biserial and biserial 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,
  • coefficients of variation and standard deviations and ratios thereof,
  • raw and transformed Cronbach's alpha values,
  • partial and semi-partial correlation coefficients.

For raw and Fisher's r-to-z transformed correlation coefficients, rcalc() can construct the entire var-cov matrix of (partially) overlapping correlations. The var-cov matrix of dependent estimates more generally can also be constructed with the vcalc() function.

Models and Analysis Approaches

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

  • equal/fixed/random-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 (rma.mh() 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 (rma.mv() function),
  • models for network meta-analyses and mixed treatment comparisons (rma.mv() function),
  • models for phylogenetic meta-analyses (rma.mv() function),
  • spatio-temporal meta-analytic models (rma.mv() function),
  • subgrouping and (mixed-effects) meta-regression analyses,
  • location-scale models (rma() function using the scale argument),
  • models with user-defined weights.

Plots and Figures

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

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),
  • file drawer analysis / fail-safe N computation (fsn() function),
  • the test of excess significance (tes() function),
  • selection models (selmodel() 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),
  • improved tests/confidence intervals using the Knapp and Hartung method,
  • confidence intervals for heterogeneity statistics (confint() function),
  • cluster-robust inference methods / robust variance estimation (robust() function),
  • permutation tests (permutest() function),
  • cumulative meta-analysis (cumul() function),
  • fitted and predicted outcomes (fitted() and predict() functions),
  • best linear unbiased predictions (ranef() and blup() functions),
  • 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 multimodel inference (see here for an illustration), the boot package for bootstrapping (see here and here for illustrations), 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:

Datasets

The package also includes over 60 datasets from published meta-analyses that can be used for teaching and illustration purposes (now part of the metadat package).

Notes

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: 2023/09/05 16:43 by Wolfgang Viechtbauer