Skip to content

[R-meta] adapting forest plot visual

9 messages · Norman DAURELLE, Gerta Ruecker, Michael Dewey +1 more

#
Dear list,I have now run a meta-analysis based on relationship slopes between two variables and I am trying to make the forest plot easily readable and understandable.I used the "order" parameter of the forest function to order outcomes from lowest estimate on the first line to highest estimate on the last line, but I would like to display the outcomes that share a characteristic in the same colour ( for example, all effect-sizes coming from studies conducted in the same country displayed in one colour ). I have been looking for a way to do that in the documentation of the forest function of the meta package, but there are a lot of arguments to that function and I can't find one that does what I would like to do. It doesn't necessarily have to be based on colour but if I can change the shape of the square representing the effect sizes that come from the same place for example that would also do the trick, even though colour is more direct.Would you know of a way to do that ? Thank you !Norman
#
Dear Norman,

The arguments you need for forest.meta are col.study, maybe also 
col.square and col.square.lines or col.inside, see help("forest.meta"). 
These arguments can also be vectors with the length equal to the number 
of studies.

Here is an example:

library(meta)
data("Olkin95")
m1 <- metabin(event.e, n.e, event.c, n.c, data = Olkin95)
forest(m1, col.study = heat.colors(70))
forest(m1, col.study = c(rep("black", 10), rep("red",10), rep("blue", 
10), rep("green",10), rep("orange",10), rep("gray",10), rep("violet",10)))

You may define the color vector before, using your characteristic and 
the desired order.

Best,

Gerta

Am 02.06.2020 um 13:24 schrieb Norman DAURELLE:

  
    
#
Dear Norman

There is a package on CRAN called forestplot which claims to provide 
comprehensive options for controlling the forest plot so if you cannot 
find how to do it in your preferred package (which you do not name 
incidentally) then it might be worth investigating. Disclaimer: I have 
never used it myself.

Michael
On 02/06/2020 12:24, Norman DAURELLE wrote:

  
    
  
#
I think he mentioned the meta package, therefore I provided an example 
how to do it in meta. Disclaimer: I have often used it myself ;-)

Best,

Gerta

Am 03.06.2020 um 11:05 schrieb Michael Dewey:
#
Dear all, dear Greta and Michael,
thank you for your answers, I am indeed using the function forest (or forest.rma, which gives the same result I think when I look up the documentation through "help") from the package meta.
I use the rma() function from the metafor package to perform the meta-analysis. I have read about the forestplot function from the package named the same, and I tried to use it, but the first plot I got with it was not that nice, so I went back to digging deeper into the forest function from the package meta.
Special thanks Greta for the advice about the arguments col.study, col.square, col.square.lines and col.inside, I was trying to use the argument leftcols, without much success.Have a nice day !Norman
----- Mail d'origine -----
De: Gerta Ruecker <ruecker at imbi.uni-freiburg.de>
?: Michael Dewey <lists at dewey.myzen.co.uk>, Norman DAURELLE <norman.daurelle at agroparistech.fr>, r-sig-meta-analysis at r-project.org
Envoy?: Wed, 03 Jun 2020 11:22:15 +0200 (CEST)
Objet: Re: [R-meta] adapting forest plot visual

I think he mentioned the meta package, therefore I provided an example 
how to do it in meta. Disclaimer: I have often used it myself ;-)

Best,

Gerta

Am 03.06.2020 um 11:05 schrieb Michael Dewey:
#
Hello again everyone, 
I tired to use the arguments that you suggested Gerta, (col.study, col.square, col.square.lines and col.inside),but every time I got the same result, with nothing changed from the original plot,and warnings that read " In segments(...) : "col.study" is not a graphical parameter ".I tried to run the example you gave me though, and it worked alright, even though there were many lines not fitting in the plot I believe, but I could see the different colours for each effect size or for groups of effect sizes.Also, I am working with an object that is the result of using the rma function from the package metafor, and I don't quite understand what difference exists between rma, meta, and robu objects.I used the robu() function to have a result that accounts for the fact that some of the studies I use provide multiple effect-sizes to my meta-analysis, as shown in the youtube video by Daniel Quintana explaining his 2015 article,"From pre-registration to publication : a non-technical primer for conducting a meta-analysis to synthesize correlational data".However, when I try to use the forest function with the robu object it doesn't work.Would you know what exactly differs between these rma, meta, and robu objects ?  I understand that they are the results of different functions, but they are supposed to be meta-analysis results, so in my mind they should have been of the same format, or at least I should still be able to use the robu object in the forest function since the forest plot is the main result of the meta-analysis. 
Do you have any advice ?Thank you !Norman

----- Mail d'origine -----
De: Norman DAURELLE <norman.daurelle at agroparistech.fr>
?: r-sig-meta-analysis at r-project.org
Cc: Michael Dewey <lists at dewey.myzen.co.uk>, ruecker at imbi.uni-freiburg.de
Envoy?: Thu, 04 Jun 2020 01:12:06 +0200 (CEST)
Objet: Re: [R-meta] adapting forest plot visual

Dear all, dear Greta and Michael,
thank you for your answers, I am indeed using the function forest (or forest.rma, which gives the same result I think when I look up the documentation through "help") from the package meta.
I use the rma() function from the metafor package to perform the meta-analysis. I have read about the forestplot function from the package named the same, and I tried to use it, but the first plot I got with it was not that nice, so I went back to digging deeper into the forest function from the package meta.
Special thanks Greta for the advice about the arguments col.study, col.square, col.square.lines and col.inside, I was trying to use the argument leftcols, without much success.
Have a nice day !
Norman
----- Mail d'origine -----
De: Gerta Ruecker <ruecker at imbi.uni-freiburg.de>
?: Michael Dewey <lists at dewey.myzen.co.uk>, Norman DAURELLE <norman.daurelle at agroparistech.fr>, r-sig-meta-analysis at r-project.org
Envoy?: Wed, 03 Jun 2020 11:22:15 +0200 (CEST)
Objet: Re: [R-meta] adapting forest plot visual
I think he mentioned the meta package, therefore I provided an example 
how to do it in meta. Disclaimer: I have often used it myself ;-)
Best,
Gerta
Am 03.06.2020 um 11:05 schrieb Michael Dewey:
--
Dr. rer. nat. Gerta R?cker, Dipl.-Math.
Institute of Medical Biometry and Statistics,
Faculty of Medicine and Medical Center - University of Freiburg
Stefan-Meier-Str. 26, D-79104 Freiburg, Germany
Phone: +49/761/203-6673
Fax: +49/761/203-6680
Mail: ruecker at imbi.uni-freiburg.de
Homepage: https://www.uniklinik-freiburg.de/imbi.html
#
Dear Norman,

To avoid any confusion, I want to add that

- There are the two packages for meta-analysis, meta and metafor.

- Each of them has its own function for creating forest plots.

- Both functions can be called simply using forest(), and this is unique 
as long as there is only one package loaded.

- If you have loaded both packages, the function from the later loaded 
package is used (because it is first on the search path). To see this, 
write for example:

library(metafor)
library(meta)
find("forest")
[1] "package:meta"??? "package:metafor"

- If both packages are loaded, you can specify the function you want to 
use by calling either forest.rma or forest.meta.

- The arguments I recommended were from forest.meta, not from 
forest.rma, and therefore will not (necessarily) work in the other package.

- The same holds for some other function names that occur in both 
packages (baujat, funnel, labbe, radial, trimfill).

Best,

Gerta


Am 04.06.2020 um 01:12 schrieb Norman DAURELLE:
#
Dear Norman

There are many packages which perform meta-analysis in one form or 
another, there are 100+ on CRAN, so it is unlikely that they will result 
in objects with the same format. Since the R way is to access the 
results of the fit using the extractor functions the authors are 
entitled to change the internals as much as they like. I suggest that 
for a given analysis you choose one of meta or metafor and stick to it 
as far as possible.

Michael
On 04/06/2020 07:18, Norman DAURELLE wrote:

  
    
  
#
Hi,

To add to Gerta's description.

R packages meta and metafor work in parallel. If you call 
forest(ma.object), either R function forest.meta() or forest.rma() is 
called internally depending on whether ma.object has been created with 
meta or metafor.

However, it is essential that you have to have a look at the proper help 
page for more information on forest.meta() or forest.rma().

You can get an overview using help(meta) or help(metafor), respectively. 
For meta, you can than click on the link for the forest function or use 
the R command help(forest.meta). For metafor the command is 
help(forest.rma).

Best wishes, Guido