The metafor Package

A Meta-Analysis Package for R

User Tools

Site Tools


news:news

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
news:news [2021/04/25 12:42] Wolfgang Viechtbauernews:news [2023/08/13 10:21] Wolfgang Viechtbauer
Line 3: Line 3:
 ~~NOTOC~~ ~~NOTOC~~
  
-==== April 25th, 2021Better Degrees of Freedom Calculation ====+==== 2023-08-13Dynamic Plot Colors Based on the RStudio Theme ====
  
-In random/mixed-effects models as can be fitted with the [[https://wviechtb.github.io/metafor/reference/rma.html|rma()]] function, tests and confidence intervals for the model coefficients are by default constructed based on a standard normal distribution.((In a random-effects model, there is just one coefficient, namely $\hat{\mu}$, the estimated average true outcome.)) In general, it is better to use the Knapp-Hartung method for this purpose, which does two things: (1) the standard errors of the model coefficients are estimated in a slightly different way and (2) a t-distribution is used with $k-p$ degrees of freedom (where $k$ is the total number of estimates and $p$ the number of coefficients in the model). When conducting a simultaneous (or 'omnibus') test of multiple coefficients, then an F-distribution with $m$ and $k-p$ degrees of freedom is used (for the 'numeratorand 'denominator' degrees of freedom, respectively), with $m$ denoting the number of coefficients tested. To use this method, set argument ''test="knha"''.+I am quite excited about a new feature that will be part of the upcoming version of the metafor package. The package now creates all plots in such a way that (if one sets ''[[https://wviechtb.github.io/metafor/reference/mfopt.html|setmfopt]]''''(theme="auto")'') they will have a consistent look depending on the chosen [[https://docs.posit.co/ide/user/ide/guide/ui/appearance.html#editor-themes|RStudio theme]]. You can see below some examples of how various plots change their look according to the theme:
  
-The Knapp-Hartung method cannot be directly generalized to more complex models as can be fitted with the [[https://wviechtb.github.io/metafor/reference/rma.mv.html|rma.mv()]] function, although we can still use tand F-distributions for conducting tests of one or multiple model coefficients in the context of such models. This is possible by setting ''test="t"''. However, this then raises the question how the (denominator) degrees of freedom for such tests should be calculated. By default, the degrees of freedom are calculated as described above. However, this method does not reflect the complexities of models that are typically fitted with the ''rma.mv()'' function. For example, in multilevel models (with multiple estimates nested within studies), a predictor (or 'moderator') may be measured at the study level (i.e., it is constant for all estimates belonging to the same study) or at the level of the individual estimates (i.e., it might vary within studies). By setting argument ''dfs="contain"'', a method is used for calculating the degrees of freedom that tends to provide tests with better control of the Type I error rate and confidence intervals with closer to nominal coverage rates. See the documentation of the function for further details.+{{news:plots-rstudio-theme.mp4?800x500&nolink}}
  
-==== April 24th2021: Scatter Plots / Bubble Plots for Meta-Regression Models ====+This creates a more pleasing experience when working interactively with RStudiobut could also be useful when creating presentations that do not use a white background. 
  
-finally got around to adding function to the package for drawing scatter plots (also called bubble plots) for meta-regression modelsSee the documentation of the [[https://wviechtb.github.io/metafor/reference/regplot.html|regplot()]] function for further details.+The default setting (''[[https://wviechtb.github.io/metafor/reference/mfopt.html|setmfopt]]''''(theme="default")'') uses the default colors of the plotting device (which is typically a white background and a black foreground color), but one can also use ''[[https://wviechtb.github.io/metafor/reference/mfopt.html|setmfopt]]''''(theme="dark")'' to force plots to be drawn using a 'dark mode' (this may be useful when working with a different programming editor or IDE that also uses a dark mode). 
 + 
 +==== 2023-05-08: Version 4.2-0 Released on CRAN ==== 
 + 
 +made a relatively quick release of another version of the package. There were a few minor little buglets that annoyed me that I wanted to get rid of right away. Along the way, I made some improvements to various plotting functions. In particular, the various ''forest()'' functions now do better job of choosing default values for the ''xlim'' argument and the ''ilab.xpos'' argument values are now also automatically chosen when not specified (although it is still recommended to adjust the default values to tweak the look of each forest plot into perfection). There is now also a ''shade'' argument for shading particular rows of the plot (e.g., for a 'zebra-like' look). 
 + 
 +Also, the various plotting functions now respect ''par("fg")''. This makes it possible to easily create plots with a dark background and light plotting colors. By default, plots created in R have a light (white) background and use dark colors, like this: 
 + 
 +{{news:plots-light.png?nolink}} 
 + 
 +But if we set up the plotting device like this: 
 + 
 +<code rsplus> 
 +bg <- "gray10" 
 +fg <- "gray95" 
 +dev.new(canvas=bg) 
 +par(fg=fg, bg=bg, col=fg, col.axis=fg, col.lab=fg, col.main=fg, col.sub=fg) 
 +</code> 
 + 
 +then the resulting plots look like this: 
 + 
 +{{news:plots-dark.png?nolink}} 
 + 
 +So in case you prefer a dark mode for your IDE/editor, opening a plot in this manner no longer feels like starring directly into the sun. 
 + 
 +{{news:sunshine.jpg?nolink}} 
 + 
 +Such an awesome [[https://en.wikipedia.org/wiki/Sunshine_(2007_film)|movie]], by the way. 
 + 
 +Finally, aside from a few other improvements (e.g., functions that issue a warning when omitting studies due to NAs now indicate how many were omitted), the ''rma.glmm()'' function (when ''measure="OR", model="CM.EL", method="ML"'') now treats $\tau^2$ values below 1e-04 effectively as zero before computing the standard errors of the fixed effectsThis helps to avoid numerical problems in approximating the Hessian. Similarly, ''selmodel()'' now treats $\tau^2$ values below 1e-04 or ''min(vi/10)'' effectively as zero before computing the standard errors. 
 + 
 +The full changelog can be found [[:updates#version_42-0_2023-05-08|here]]. 
 + 
 +==== 2023-03-19: Version 4.0-0 Released on CRAN ==== 
 + 
 +I am excited to announce the official (i.e., CRAN) release of version 4.0-0 of the metafor package. This will be the 30th update to the package after its initial release in 2009. Since then, the package has grown from a measly 4460 lines of code / 60 functions / 76 pages of documentation to a respectable 36879 lines of code / 330 functions / 347 pages of documentation. Aside from a few improvements related to modeling (e.g., the ''[[https://wviechtb.github.io/metafor/reference/emmprep.html|emmprep()]]'' function provides easier interoperability with the [[https://cran.r-project.org/package=emmeans|emmeans]] package and the ''[[https://wviechtb.github.io/metafor/reference/selmodel.html|selmodel()]]'' function gains a few additional selection models), I would say the focus of this update was on steps that occur prior to modeling, namely the calculation of the chosen effect size measure (or outcome measure as I prefer to call it) and the construction of the dataset in general. 
 + 
 +In particular, the ''[[https://wviechtb.github.io/metafor/reference/escalc.html|escalc()]]'' function now allows the user to also input appropriate test statistics and/or p-values for a number of measures where these can be directly transformed into the corresponding values of the measure. For example, the t-statistic from an independent samples t-test can be easily transformed into a standardized mean difference or the t-statistic from a standard test of a correlation coefficient can be easily transformed into the correlation coefficient or its r-to-z transformed version. Speaking of the latter, essentially all correlation-type measures can now be transformed using the r-to-z transformation, although it should be noted that this is not a proper variance-stabilizing transformation for all measures. This can still be useful though since the r-to-z transformation also has normalizing properties and when combining different types of correlation coefficients in the same analysis (e.g., Pearson product-moment correlations and tetrachoric/biserial correlations). 
 + 
 +Finally, there are now several functions in the package that facilitate the construction of the dataset for a meta-analysis more generally. The ''[[https://wviechtb.github.io/metafor/reference/conv.2x2.html|conv.2x2()]]'' function helps to reconstruct 2x2 tables based on various pieces of information (e.g., odds ratios, chi-square statistics), while the ''[[https://wviechtb.github.io/metafor/reference/conv.fivenum.html|conv.fivenum()]]'' function provides various methods for computing (or more precisely, estimating) means and standard deviations based on five-number summary values (i.e., the minimum, first quartile, median, third quartile, and maximum) and subsets thereof. The ''[[https://wviechtb.github.io/metafor/reference/conv.wald.html|conv.wald()]]'' function converts Wald-type tests and/or confidence intervals to effect sizes and corresponding sampling variances (e.g., to transform a reported odds ratio and its confidence interval to the corresponding log odds ratio and sampling variance). And the ''[[https://wviechtb.github.io/metafor/reference/conv.delta.html|conv.delta()]]'' function transforms effect sizes or outcomes and their sampling variances using the delta method, which can be useful in several data preparations steps. See the documentation of these functions for further details and examples. 
 + 
 +If you come across any issues/bugs, please report them [[https://github.com/wviechtb/metafor/issues|here]]. However, for questions or discussions about these functions (or really anything related to the metafor package or meta-analysis with R in general), please use the [[https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis|R-sig-meta-analysis]] mailing list.
  
news/news.txt · Last modified: 2024/03/29 10:44 by Wolfgang Viechtbauer