Learn R Programming

metafor (version 1.4-0)

metafor-package: Metafor: A Meta-Analysis Package for R

Description

The metafor package provides functions for conducting meta-analyses in R. Currently, there are functions to fit the meta-analytic fixed- and random-effects model via the general linear (mixed-effects) model, the Mantel-Haenszel method, and Peto's method (the latter two only for fixed-effects models). Moderators (study-level covariates) can be included when using the general linear (mixed-effects) model approach, allowing the user to fit meta-regression models. The package also provides various plot functions (for example, for forest, funnel, and radial plots) and functions for assessing the model fit and obtaining case diagnostics.

Arguments

The rma.uni Function

The various meta-analytic models that are usually used in practice are special cases of the general linear (mixed-effects) model. The rma.uni function (with alias rma) provides a general framework for fitting the various models. The function can be used in conjunction with any of the usual effect size or outcome measures used in meta-analyses (e.g., log odds ratios, log relative risks, risk differences, mean differences, standardized mean differences, raw correlation coefficients, correlation coefficients transformed with Fisher's r-to-z transformation, and so on). For details on these effect size or outcome measures, see the documentation of the escalc function. The notation and models underlying the rma.uni function are explained below. For a set of $i = 1, \ldots, k$ independent studies, let $y_i$ denote the observed value of the effect size or outcome measure in the $i^{th}$ study. Let $\theta_i$ denote the corresponding (unknown) true effect or outcome in the $i^{th}$ study, such that $y_i | \theta_i \sim N(\theta_i, v_i)$. In other words, the observed effects or outcomes are assumed to be unbiased and normally distributed estimates of the corresponding true effects or outcomes with sampling variances equal to $v_i$. The $v_i$ values are assumed to be known. Depending on the outcome measure used, a bias correction, normalizing, and/or variance stabilizing transformation may be necessary to ensure that these assumptions are (approximately) true (e.g., the log transformation for odds ratios, Fisher's r-to-z transformation for correlations; see section escalc for more details). The fixed-effects model conditions on the true effects or outcomes and therefore provides a conditional inference about the set of $k$ studies included in the meta-analysis. This implies that the fitted model provides an estimate of $\bar{\theta}_w = \sum_{i=1}^k w_i \theta_i / \sum_{i=1}^k w_i$, that is, the weighted average of the true effects in the set of $k$ studies, with weights equal to $w_i = 1/v_i$. One can also employ an unweighted estimation method, which provides an estimate of the unweighted average of the true effects in the set of $k$ studies (i.e., an estimate of $\bar{\theta}_u = 1/k \sum_{i=1}^k \theta_i$). Moderators can be included in the fixed-effects model, yielding a fixed-effects with moderators model. Again, since the model conditions on the set of $k$ studies included in the meta-analysis, the regression coefficients from the fitted model estimate the weighted least squares relationship between the true effects and the moderator variables within the set of $k$ studies included in the meta-analysis (again using weights equal to $w_i = 1/v_i$). The (unweighted) least squares relationship between the true effects and the moderator variables can be obtained when using the unweighted estimation method. The random-effects model does not condition on the true effects. Instead, the $k$ studies included in the meta-analysis are assumed to be a random selection from a hypothetical population of studies. One can envision this hypothetical population as an essentially infinite set of studies comprising all of the studies that have been conducted, that could have been conducted, or that may be conducted in the future. The true effects or outcomes in this population of studies are assumed to be normally distributed with $\mu$ denoting the average effect and $\tau^2$ denoting the variance of the true effects in the population ($\tau^2$ is therefore often referred to as the amount of heterogeneity in the population of studies). The fitted model provides an estimate of $\mu$ and $\tau^2$. Consequently, the random-effects model provides an unconditional inference about the average effect in the population of studies from which the $k$ studies included in the meta-analysis are assumed to be a random selection. When including moderator variables in the random-effects model, we obtain what is typically called a mixed-effects model in the meta-analytic literature. The coefficients from the fitted model then estimate the relationship between the average true effect or outcome in the population of studies and the moderator variables included in the model. The value of $\tau^2$ in the mixed-effects model denotes the amount of residual heterogeneity in the true effects or outcomes (i.e., the amount of variability among the true effects or outcomes that is not accounted for by the moderators included in the model). One can also choose between weighted and unweighted estimation in the context of the random- and mixed-effects model, although the parameters that are estimated remain the same regardless of the estimation method used (as opposed to the fixed-effects model case, where the parameter estimated is different for weighted and unweighted estimation). Contrary to what is often stated in the literature, it is important to realize that the fixed-effects model does not assume that the true effects or outcomes are homogeneous (i.e., that $\theta_i$ is equal to some common value $\theta$ for all $k$ studies). In other words, fixed-effects models provide perfectly valid inferences under heterogeneity, as long as one is restricting these inferences (i.e., conclusions about the average effect) to the set of studies included in the meta-analysis (more specifically, to sets of $k$ studies with true effects equal to the true effects of the $k$ studies included in the meta-analysis). On the other hand, the random-effects model provides an inference about the average effect in the entire population of studies from which the included studies are assumed to be a random selection. In the special case that the true effects are actually homogeneous, the distinction between the various models disappears, since homogeneity implies that $\mu = \bar{\theta}_w = \bar{\theta}_u \equiv \theta$. However, since there is no infallible method to test whether the true effects are really homogeneous or not, a researcher should decide on the type of inference desired before examining the data and choose the model accordingly. For more details on the distinction between fixed- and random-effects models, see Hedges and Vevea (1998) and Laird and Mosteller (1990).

The rma.mh Function

The Mantel-Haenszel method provides an alternative approach to fitting the fixed-effects model when dealing with studies providing data in the form of 2x2 tables (Mantel & Haenszel, 1959). The method is particularly advantageous when aggregating a large number of tables with small sample sizes (the so-called sparse data or increasing strata case). The Mantel-Haenszel method is implemented in the rma.mh function. It can be used in combination with odds ratios, relative risks, and risk differences. The Mantel-Haenszel method is always based on a weighted estimation approach.

The rma.peto Function

Yet another method that can be used in the context of a meta-analysis of 2x2 tables is Peto's method (see Yusuf et al., 1985), implemented in the rma.peto function. It is a weighted estimation approach for the combination of odds ratios.

Future Plans and Updates

The metafor package is a work in progress and is updated on a regular basis with new functions and options. With metafor.news, you can read the NEWS file of the package after installation. Comments, feedback, and suggestions for improvements are very welcome. And since this is a frequently-asked-question: Functions for conducting multivariate meta-analyses and for handling correlated outcomes are currently under development and will be included in the package at a later point.

References

Cooper, H. C., Hedges, L. V. & Valentine, J. C. (Eds.) (2009). The handbook of research synthesis and meta-analysis (2nd ed.). New York: Russell Sage Foundation. Hedges, L. V. & Olkin, I. (1985). Statistical methods for meta-analysis. San Diego, CA: Academic Press. Hedges, L. V. & Vevea, J. L. (1998). Fixed- and random-effects models in meta-analysis. Psychological Methods, 3, 486--504. Laird, N. M. & Mosteller, F (1990). Some statistical methods for combining experimental results. International Journal of Technology Assessment in Health Care, 6, 5--30. Mantel, N. & Haenszel, W. (1959). Statistical aspects of the analysis of data from retrospective studies of disease. Journal of the National Cancer Institute, 22, 719--748. Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1--48. http://www.jstatsoft.org/v36/i03/. Yusuf, S., Peto, R., Lewis, J., Collins, R. & Sleight, P. (1985). Beta blockade during and after myocardial infarction: An overview of the randomized trials. Progress in Cardiovascular Disease, 27, 335--371.