# The metafor Package

A Meta-Analysis Package for R

news:news

## Package News

### 2022-05-24: Increasing Value of $\tau^2$ When Adding Moderators

In (mixed-effects) meta-regression models, it can happen that the estimate of $\tau^2$ (which denotes the amount of heterogeneity not accounted for by the model) exceeds the estimate of $\tau^2$ from the random-effects model (which denotes the total amount of heterogeneity). I have written up a little illustration to demonstrate and discuss this somewhat counterintuitive result here.

### 2022-04-27: Forest Plot with Aggregated Values

When a meta-analysis involves studies that contribute multiple effect size estimates to the analysis, the dataset can quickly become so large that drawing a forest plot of the individual estimates becomes infeasible. As an alternative visualization, we can aggregate estimates within studies and then use these aggregated values in a forest plot. I have written up a little illustration to show how this can be done.

### 2022-04-21: Version 3.4 Released on CRAN

A new version of the metafor package (version 3.4) has been released. Some highlights:

• The vcalc() function was added. With this function, one can construct or approximate the variance-covariance matrix of dependent effect sizes for a wide variety of circumstances.
• The robust() function, for cluster-robust inferences (also known as robust variance estimation), now interfaces fully with the excellent clubSandwich package, so one can make use of the improved methods therein.
• For meta-analyses involving complex dependency structures, vcalc(), rma.mv(), and robust(..., clubSandwich=TRUE) are all part of a general workflow that can handle the vast majority of dependencies in meta-analyses, as described here.
• The aggregate.escalc() method – for aggregating escalc datasets with dependent effect sizes to a higher level – has a new 'structure' (struct="CS+CAR") if there are effects at multiple time points and multiple effect sizes at these time points.
• A few more measures were added to escalc(): "MPORM" for computing marginal log odds ratios based on marginal 2x2 tables and "REH" for computing the (log transformed) relative excess heterozygosity (this is a bit more esoteric stuff).
• rma.glmm() – for meta-analytic generalized linear (mixed-effects) models – allows more flexibility in the coding of the group variable and whether the random study effects should be allowed to be correlated with the random group effects.
• Even more optimizer choices for rma.mv() (including a subspace-searching simplex algorithm and the Barzilai-Borwein gradient decent method): If you can't get the model to converge with any of the available options, all hope is lost!
• All datasets that used to be part of the metafor package have now been moved to the metadat package (which now includes even more meta-analysis datasets).
• A bunch of smaller convenience features (e.g., some as.data.frame() methods, a refit argument in anova(), more use of a data argument), a few clever tricks with a custom package environment to store settings, and free candy (not really).
• Lots of documentation updates, including a description of fixed- versus random-effects models, some recommended practices, and miscellaneous options and features.

The full changelog can be found here.

### 2022-03-20: Forest Plot with Exact Confidence Intervals

A question was recently raised on the R-sig-meta-analysis mailing list that asked about the difference between the confidence intervals shown in forest plots and those computed based on 'exact' methods (see here for the question and here for my response). Using a slightly more common example of a meta-analysis based on $2 \times 2$ table data, I have written up a little illustration to show how one can create a forest plot with exact confidence intervals.

### 2022-03-12: Over 10,000 Citations

Since I don't obsessively check my Google Scholar profile like everybody else does, it is by mere coincidence that I noticed that my JSS paper about the metafor package has now been cited more than 10,000 times (of course, like everybody else, I will ignore the Web of Science count, which isn't quite there yet ...). I greatly appreciate that people are citing the paper and hence supporting the creation and maintenance of this R package in this way. It can still be difficult to receive proper credit for software development in academia, so citing the software is one of the best ways that you can support developers in their work (aside from donating a million bucks you happen to have lying around). I think it also helps if there is a paper or book about the software, which is sometimes a bit easier to cite than the software itself (what was again the APA style for citing software?) and citation counts are more easily tracked for papers/books than citations of the software itself.

### 2022-03-06: Specifying Inputs to the rma() Function

Unfortunately, I have seen a number of cases where users of the metafor package have misspecified the inputs to the rma() function, giving the standard errors of the effect sizes as an unnamed second argument. This will lead to incorrect results. To explain the problem in more detail (and so that I can simply point people to a place where this issue is explained thoroughly), I have written up this discussion.

### 2022-01-02: More Forest Plot Examples

Happy New Year! Hope this one will be at least marginally less crazy than the previous ones ...

I was recently asked whether I would add the feature to show multiple confidence intervals for each of the studies in a forest plot (e.g., by using lines with varying thickness) to the metafor package. Turns out that one can already do this without too much difficulty using the existing tools, simply by superimposing two forest plots on top of each other. This is illustrated here.

I also wanted to see to what extent one can reproduce forest plots created by different software or using the aesthetics of certain journals. I started with the recreation of a forest plot that was obtained using RevMan, the software provided by the Cochrane Collaboration for conducting and authoring Cochrane reviews. You can find the figure and corresponding code for this here. Then I recreated a forest plot that was obtained from an article in the British Medical Journal. The resulting figure and code can be found here.

Although it takes a bit of effort to recreate these figures (especially if one wants to make them look almost identical to the originals), it shows that one can essentially recreate any forest plot using the various forest() functions from metafor and then some additional functions like text(), points(), and so on, which give you full control over how things are drawn and the information included in the figure.