The metafor Package

A Meta-Analysis Package for R

Changes in Version 2.0-0 (2017-06-22)

• added simulate() method for rma objects; added MASS to Suggests (since simulating for rma.mv objects requires mvrnorm() from MASS)
• cooks.distance.rma.mv() now works properly even when there are missing values in the data
• residuals() gains type argument and can compute Pearson residuals
• the newmods argument in predict() can now be a named vector or a matrix/data frame with column names that get properly matched up with the variables in the model
• added ranef.rma.mv() for extracting the BLUPs of the random effects for rma.mv models
• all functions that repeatedly refit models now have the option to show a progress bar
• added ranktest.default(), so user can now pass the outcomes and corresponding sampling variances directly to the function
• added regtest.default(), so user can now pass the outcomes and corresponding sampling variances directly to the function
• funnel.default() gains subset argument
• funnel.default() and funnel.rma() gain col and bg arguments
• plot.profile.rma() gains ylab argument
• more consistent handling of robust.rma objects
• added a print method for rma.gosh objects
• the (log) relative risk is now called the (log) risk ratio in all help files, plots, code, and comments
• escalc() can now compute outcome measures based on paired binary data ("MPRR", "MPOR", "MPRD", "MPORC", and "MPPETO")
• escalc() can now compute (semi-)partial correlation coefficients ("PCOR", "ZPCOR", "SPCOR")
• escalc() can now compute measures of variability for single groups ("CVLN", "SDLN") and for the difference in variability between two groups ("CVR", "VR"); also the log transformed mean ("MNLN") has been added for consistency
• escalc() can now compute the sampling variance for measure="PHI" for studies using stratified sampling (vtpye="ST")
• the [ method for escalc objects now properly handles the ni and slab attributes and does a better job of cleaning out superfluous variable name information
• added rbind() method for escalc objects
• added as.data.frame() method for list.rma objects
• added a new dataset (dat.pagliaro1992) for another illustration of a network meta-analysis
• added a new dataset (dat.laopaiboon2015) on the effectiveness of azithromycin for treating lower respiratory tract infections
• rma.uni() and rma.mv() now check if the ratio of the largest to smallest sampling variance is very large; results may not be stable then (and very large ratios typically indicate wrongly coded data)
• model fitting functions now check if extra/superfluous arguments are specified via ... and issues are warning if so
• instead of defining own generic ranef(), import ranef() from nlme
• improved output formatting
• added more tests (but disabled a few tests on CRAN to avoid some issues when R is compiled with --disable-long-double)
• some general code cleanup
• renamed diagram_metafor.pdf vignette to just diagram.pdf
• minor updates in the documentation

Changes in Version 1.9-9 (2016-09-25)

• started to use git as version control system, GitHub to host the repository (https://github.com/wviechtb/metafor) for the development version of the package, Travis CI as continuous integration service (https://travis-ci.org/wviechtb/metafor), and Codecov for automated code coverage reporting (https://codecov.io/github/wviechtb/metafor)
• argument knha in rma.uni() and argument tdist in rma.glmm() and rma.mv() are now superseded by argument test in all three functions; for backwards compatibility, the knha and tdist arguments still work, but are no longer documented
• rma(yi, vi, weights=1, test="knha") now yields the same results as rma(yi, vi, weighted=FALSE, test="knha") (but use of the Knapp and Hartung method in the context of an unweighted analysis remains an experimental feature)
• one can now pass an escalc object directly to rma.uni(), which then tries to automatically determine the yi and vi variables in the data frame (thanks to Christian Röver for the suggestion)
• escalc() can now also be used to convert a regular data frame to an escalc object
• for measure="UCOR", the exact bias-correction is now used (instead of the approximation); when vtype="UB", the exact equation is now used to compute the unbiased estimate of the variance of the bias-corrected correlation coefficient; hence gsl is now a suggested package (needed to compute the hypergeometric function) and is loaded when required
• cooks.distance() now also works with rma.mv objects; and since model fitting can take some time, an option to show a progress bar has been added
• fixed an issue with robust.rma.mv() throwing errors when the model was fitted with sparse=TRUE
• fixed an error with robust.rma.mv() when the model was fitted with user-defined weights (or a user-defined weight matrix)
• added ranef() for extracting the BLUPs of the random effects (only for rma.uni objects at the moment)
• reverted back to the pre-1.1-0 way of computing p-values for individual coefficients in permutest.rma.uni(), that is, the p-value is computed with mean(abs(z_perm) >= abs(z_obs) - tol) (where tol is a numerical tolerance)
• permutest.rma.uni() gains permci argument, which can be used to obtain permutation-based CIs of the model coefficients (note that this is computationally very demanding and may take a long time to complete)
• rma.glmm() continues to work even when the saturated model cannot be fitted (although the tests for heterogeneity are not available then)
• rma.glmm() now allows control over the arguments used for method.args (via control=list(hessianCtrl=list(...))) passed to hessian() (from the numDeriv package) when using model="CM.EL" and measure="OR"
• in rma.glmm(), default method.args value for r passed to hessian() has been increased to 16 (while this slows things down a bit, this appears to improve the accuracy of the numerical approximation to the Hessian, especially when tau^2 is close to 0)
• the various forest() and addpoly() functions now have a new argument called width, which provides manual control over the width of the annotation columns; this is useful when creating complex forest plots with a monospaced font and we want to ensure that all annotations are properly lined up at the decimal point
• the annotations created by the various forest() and addpoly() functions are now a bit more compact by default
• more flexible efac argument in the various forest() functions
• trailing zeros in the axis labels are now dropped in forest and funnel plots by default; but trailing zeros can be retained by specifying a numeric (and not an integer) value for the digits argument
• added funnel.default(), which directly takes as input a vector with the observed effect sizes or outcomes and the corresponding sampling variances, standard errors, and/or sample sizes
• added plot.profile.rma(), a plot method for objects returned by the profile.rma.uni() and profile.rma.mv() functions
• simplified baujat.rma.uni(), baujat.rma.mh(), and baujat.rma.peto() to baujat.rma(), which now handles objects of class rma.uni, rma.mh, and rma.peto
• baujat.rma() gains argument symbol for more control over the plotting symbol
• labbe() gains a grid argument
• more logical placement of labels in qqnorm.rma.uni(), qqnorm.rma.mh(), and qqnorm.rma.peto() functions (and more control thereof)
• qqnorm.rma.uni() gains lty argument
• added gosh.rma() and plot.gosh.rma() for creating GOSH (i.e., graphical display of study heterogeneity) plots based on Olkin et al. (2012)
• in the (rare) case where all observed outcomes are exactly equal to each other, test="knha" (i.e., knha=TRUE) in rma() now leads to more appropriate results
• updated datasets so those containing precomputed effect size estimates or observed outcomes are already declared to be escalc objects
• added new datasets (dat.egger2001 and dat.li2007) on the effectiveness of intravenous magnesium in acute myocardial infarction
• methods package is now under Depends (in addition to Matrix), so that rma.mv(..., sparse=TRUE) always works, even under Rscript
• some general code cleanup
• added more tests (and used a more consistent naming scheme for tests)

Changes in Version 1.9-8 (2015-05-28)

• due to more stringent package testing, it is increasingly difficult to ensure that the package passes all checks on older versions of R; from now on, the package will therefore require, and be checked under, only the current (and the development) version of R
• added graphics, grDevices, and methods to Imports (due to recent change in how CRAN checks packages)
• the struct argument for rma.mv() now also allows for "ID" and "DIAG", which are identical to the "CS" and "HCS" structures, but with the correlation parameter fixed to 0
• added robust() for (cluster) robust tests and confidence intervals for rma.uni and rma.mv models (this uses a robust sandwich-type estimator of the variance-covariance matrix of the fixed effects along the lines of the Eicker-Huber-White method)
• confint() now works for models fitted with the rma.mv() function; for variance and correlation parameters, the function provides profile likelihood confidence intervals; the output generated by the confint() function has been adjusted in general to make the formatting more consistent across the different model types
• for objects of class rma.mv, profile() now provides profile plots for all (non-fixed) variance and correlation components of the model when no component is specified by the user (via the sigma2, tau2, rho, gamma2, or phi arguments)
• for measure="MD" and measure="ROM", one can now choose between vtype="LS" (the default) and vtype="HO"; the former computes the sampling variances without assuming homoscedasticity, while the latter assumes homoscedasticity
• multiple model objects can now be passed to the fitstats(), AIC(), and BIC() functions
• check for duplicates in the slab argument is now done *after* any subsetting is done (as suggested by Michael Dewey)
• rma.glmm() now again works when using add=0, in which case some of the observed outcomes (e.g., log odds or log odds ratios) may be NA
• when using rma.glmm() with model="CM.EL", the saturated model (used to compute the Wald-type and likelihood ratio tests for the presence of (residual) heterogeneity) often fails to converge; the function now continues to run (instead of stopping with an error) and simply omits the test results from the output
• when using rma.glmm() with model="CM.EL" and inversion of the Hessian fails via the Choleski factorization, the function now makes another attempt via the QR decomposition (even when this works, a warning is issued)
• for rma.glmm(), BIC and AICc values were switched around; corrected
• more use of suppressWarnings() is made when functions repeatedly need to fit the same model, such as cumul(), influence(), and profile(); that way, one does not get inundated with the same warning(s)
• some (overdue) updates to the documentation

Changes in Version 1.9-7 (2015-05-22)

• default optimizer for rma.mv() changed to nlminb() (instead of optim() with "Nelder-Mead"); extensive testing indicated that nlminb() (and also optim() with "BFGS") is typically quicker and more robust; note that this is in principle a non-backwards compatible change, but really a necessary one; and you can always revert to the old behavior with control=list(optimizer="optim", optmethod="Nelder-Mead")
• all tests have been updated in accordance with the recommended syntax of the testthat package; for example, expect_equivalent(x,y) is used instead of test_that(x, is_equivalent_to(y))
• changed a few is_identical_to() comparisons to expect_equivalent() ones (that failed on Sparc Solaris)

Changes in Version 1.9-6 (2015-05-07)

• funnel() now works again for rma.glmm objects (note to self: quit breaking things that work!)
• rma.glmm() will now only issue a warning (and not an error) when the Hessian for the saturated model cannot be inverted (which is needed to compute the Wald-type test for heterogeneity, so the test statistic is then simply set to NA)
• rma.mv() now allows for two terms of the form ~ inner | outer; the variance components corresponding to such a structure are called gamma2 and correlations are called phi; other functions that work with objects of class rma.mv have been updated accordingly
• rma.mv() now provides (even) more optimizer choices: nlm() from the stats package, hjk() and nmk() from the dfoptim package, and ucminf() from the ucminf package; choose the desired optimizer via the control argument (e.g., control=list(optimizer="nlm"))
• profile.rma.uni() and profile.rma.mv() now can do parallel processing (which is especially relevant for rma.mv objects, where profiling is crucial and model fitting can be slow)
• the various confint() functions now have a transf argument (to apply some kind of transformation to the model coefficients and confidence interval bounds); coefficients and bounds for objects of class rma.mh and rma.peto are no longer automatically transformed
• the various forest() functions no longer enforce that the actual x-axis limits (alim) encompass the observed outcomes to be plotted; also, outcomes below or above the actual x-axis limits are no longer shown
• the various forest() functions now provide control over the horizontal lines (at the top/bottom) that are automatically added to the plot via the lty argument (this also allows for removing them); also, the vertical reference line is now placed *behind* the points/CIs
• forest.default() now has argument col which can be used to specify the color(s) to be used for drawing the study labels, points, CIs, and annotations
• the efac argument for forest.rma() now also allows two values, the first for the arrows and CI limits, the second for summary estimates
• corrected some axis labels in various plots when measure="PLO"
• axes in labbe() plots now have "(Group 1)" and "(Group 2)" added by default
• anova.rma() gains argument L for specifying linear combinations of the coefficients in the model that should be tested to be zero
• in case removal of a row of data would lead to one or more inestimable model coefficients, baujat(), cooks.distance(), dfbetas(), influence(), and rstudent() could fail for rma.uni objects; such cases are now handled properly
• for models with moderators, the predict() function now shows the study labels when they have been specified by the user (and newmods is not used)
• if there is only one fixed effect (model coefficient) in the model, the print.infl.rma.uni() function now shows the DFBETAS values with the other case diagnostics in a single table (for easier inspection); if there is more than one fixed effect, a separate table is still used for the DFBETAS values (with one column for each coefficient)
• added measure="SMCRH" to the escalc() function for the standardized mean change using raw score standardization with heteroscedastic population variances at the two measurement occasions
• added measure="ROMC" to the escalc() function for the (log transformed) ratio of means (response ratio) when the means reflect two measurement occasions (e.g., for a single group of people) and hence are correlated
• added own function for computing/estimating the tetrachoric correlation coefficient (for measure="RTET"); package therefore no longer suggests polycor but now suggest mvtnorm (which is loaded as needed)
• element fill returned by trimfill.rma.uni() is now a logical vector (instead of a 0/1 dummy variable)
• print.list.rma() now also returns the printed results invisibly as a data frame
• added a new dataset (dat.senn2013) as another illustration of a network meta-analysis
• metafor now depends on at least version 3.1.0 of R

Changes in Version 1.9-5 (2014-11-24)

• moved the stats and Matrix packages from Depends to Imports; as a result, had to add utils to Imports; moved the Formula package from Depends to Suggests
• added update.rma() function (for updating/refitting a model); model objects also now store and keep the call
• the vcov() function now also extracts the marginal variance-covariance matrix of the observed effect sizes or outcomes from a fitted model (of class rma.uni or rma.mv)
• rma.mv() now makes use of the Cholesky decomposition when there is a random = ~ inner | outer formula and struct="UN"; this is numerically more stable than the old approach that avoided non-positive definite solutions by forcing the log-likelihood to be -Inf in those cases; the old behavior can be restored with control = list(cholesky=FALSE)
• rma.mv() now requires the inner variable in an ~ inner | outer formula to be a factor or character variable (except when struct is "AR" or "HAR"); use ~ factor(inner) | outer in case it isn't
• anova.rma.uni() function changed to anova.rma() that works now for both rma.uni and rma.mv objects
• the profile.rma.mv() function now omits the number of the variance or correlation component from the plot title and x-axis label when the model only includes one of the respective parameters
• profile() functions now pass on the ... argument also to the title() function used to create the figure titles (esp. relevant when using the cex.main argument)
• the drop00 argument of the rma.mh() and rma.peto() functions now also accepts a vector with two logicals, the first applies when calculating the observed outcomes, the second when applying the Mantel-Haenszel or Peto's method
• weights.rma.uni() now shows the correct weights when weighted=FALSE
• argument showweight renamed to showweights in the forest.default() and forest.rma() functions (more consistent with the naming of the various weights() functions)
• added model.matrix.rma() function (to extract the model matrix from objects of class rma)
• funnel() and radial() now (invisibly) return data frames with the coordinates of the points that were drawn (may be useful for manual labeling of points in the plots)
• permutest.rma.uni() function now uses a numerical tolerance when making comparisons (>= or ⇐) between an observed test statistic and the test statistic under the permuted data; when using random permutations, the function now ensures that the very first permutation correspond to the original data
• corrected some missing/redundant row/column labels in some output
• most require() calls replaced with requireNamespace() to avoid altering the search path (hopefully this won't break stuff ...)
• some non-visible changes including more use of some (non-exported) helper functions for common tasks
• dataset dat.collins91985a updated (including all reported outcomes and some more information about the various trials)
• oh, and guess what? I updated the documentation ...