Hi everyone! I am new to meta-analysis methodology and I am using R software to do my quantitative synthesis. I am using random effects model to analyse my individual studies through rma function in metafor package. By using 'forest(mymodelname)', I have a basic forest plot where my individual studies are shown as Study 1, Study 2, and so on. How could I get the author and year instead? It would be better if I can get them arranged according to the observed effect size - is that possible? Also, I would like to change the title of my X axis to 'Estimated Effect Size' rather than the default title 'Observed Outcome'. Lastly, would it be possible to specify the exact weight assigned to each study in the forest plot? Many thanks in advance for your help. MK
[R-meta] modifying the default forest plot
5 messages · MK, Ken Beath, Gerta Ruecker +2 more
In the calls there is an slab parameter, use that to label your studies. To get ordered studies sort them first, before calling the metafor routine. metafor takes the standard plot parameters so just adding them at the end should work. Look up plot in the help. I?m not certain what to do for the last as I?m not quite certain what you are asking for. Ken
On 5 Dec 2017, at 4:29 pm, Mukht Kaur <theoneliberatedkaur at gmail.com> wrote: Hi everyone! I am new to meta-analysis methodology and I am using R software to do my quantitative synthesis. I am using random effects model to analyse my individual studies through rma function in metafor package. By using 'forest(mymodelname)', I have a basic forest plot where my individual studies are shown as Study 1, Study 2, and so on. How could I get the author and year instead? It would be better if I can get them arranged according to the observed effect size - is that possible? Also, I would like to change the title of my X axis to 'Estimated Effect Size' rather than the default title 'Observed Outcome'. Lastly, would it be possible to specify the exact weight assigned to each study in the forest plot? Many thanks in advance for your help. MK [[alternative HTML version deleted]]
_______________________________________________ R-sig-meta-analysis mailing list R-sig-meta-analysis at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
Hi, What about using the R package meta that has the most flexible forest function? You can specify all sorts of things, such as ordering, labels, title, x-axis label, marker type, fonts, colours, whether the weights should be plotted, and so on. See https://cran.r-project.org/web/packages/meta/index.html . Best, Gerta -- Dr. rer. nat. Gerta R?cker, Dipl.-Math. Medical Faculty and Medical Center - University of Freiburg Institute for Medical Biometry and Statistics Stefan-Meier-Strasse 26, D-79104 Freiburg, Germany Phone +49 (0)761 2036673 Fax +49 (0)761 2036680 Mail ruecker at imbi.uni-freiburg.de Web www.imbi.uni-freiburg.de/biom/ Am 05.12.2017 um 07:42 schrieb Ken Beath:
In the calls there is an slab parameter, use that to label your studies. To get ordered studies sort them first, before calling the metafor routine. metafor takes the standard plot parameters so just adding them at the end should work. Look up plot in the help. I?m not certain what to do for the last as I?m not quite certain what you are asking for. Ken
On 5 Dec 2017, at 4:29 pm, Mukht Kaur <theoneliberatedkaur at gmail.com> wrote: Hi everyone! I am new to meta-analysis methodology and I am using R software to do my quantitative synthesis. I am using random effects model to analyse my individual studies through rma function in metafor package. By using 'forest(mymodelname)', I have a basic forest plot where my individual studies are shown as Study 1, Study 2, and so on. How could I get the author and year instead? It would be better if I can get them arranged according to the observed effect size - is that possible? Also, I would like to change the title of my X axis to 'Estimated Effect Size' rather than the default title 'Observed Outcome'. Lastly, would it be possible to specify the exact weight assigned to each study in the forest plot? Many thanks in advance for your help. MK [[alternative HTML version deleted]]
_______________________________________________ R-sig-meta-analysis mailing list R-sig-meta-analysis at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
_______________________________________________ R-sig-meta-analysis mailing list R-sig-meta-analysis at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
Am 05.12.17 um 09:58 schrieb Gerta Ruecker:
Hi, What about using the R package meta that has the most flexible forest function? You can specify all sorts of things, such as ordering, labels, title, x-axis label, marker type, fonts, colours, whether the weights should be plotted, and so on. See https://cran.r-project.org/web/packages/meta/index.html .
Just to give some examples. The forest plots in the attached PDF-file
were generated using the following R commands:
library(meta)
set.seed(666)
##
mean <- 1:5
se.mean <- mean / 10
author <- sample(LETTERS, 5)
year <- 2005 + sample(-10:10, 5)
m1 <- metagen(mean, se.mean, sm = "MD",
????????????? studlab = paste(author, year))
pdf("forest18.pdf", width = 9.75, height = 4)
##
forest(m1)
forest(m1, sortvar = -TE)
forest(m1, sortvar = year)
forest(m1, xlab = "Estimated Effect Size")
forest(m1, test.overall = TRUE, colgap.forest.left = "2cm")
forest(m1, layout = "JAMA")
forest(m1, layout = "RevMan5")
##
dev.off()
You can use the arguments 'leftcols' and 'rightcols' to add / remove
columns from the left and right side of the forest plot.
Best wishes,
Guido
Dr. Guido Schwarzer (sc at imbi.uni-freiburg.de) Institute of Medical Biometry and Statistics Stefan-Meier-Str. 26, D-79104 Freiburg | Phone: +49 (0)761 203 6668 http://www.imbi.uni-freiburg.de | Fax: +49 (0)761 203 6680 -------------- next part -------------- A non-text attachment was scrubbed... Name: forest18.pdf Type: application/pdf Size: 14973 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20171205/143d33ae/attachment-0001.pdf>
Ken already gave some pointers. 1) How could I get the author and year instead? Use the 'slab' argument. For example: slab=paste(dat$author, dat$year, sep=", ")) (assuming that there are 'author' and 'year' variables in the data frame 'dat'). 2) It would be better if I can get them arranged according to the observed effect size - is that possible? Use argument: order="obs" 3) Also, I would like to change the title of my X axis to 'Estimated Effect Size' rather than the default title 'Observed Outcome'. Use argument: xlab="Estimated Effect Size" 4) Lastly, would it be possible to specify the exact weight assigned to each study in the forest plot? Use argument: showweights=TRUE Best, Wolfgang -----Original Message----- From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of Mukht Kaur Sent: Tuesday, 05 December, 2017 6:30 To: r-sig-meta-analysis at r-project.org Subject: [R-meta] modifying the default forest plot Hi everyone! I am new to meta-analysis methodology and I am using R software to do my quantitative synthesis. I am using random effects model to analyse my individual studies through rma function in metafor package. By using 'forest(mymodelname)', I have a basic forest plot where my individual studies are shown as Study 1, Study 2, and so on. How could I get the author and year instead? It would be better if I can get them arranged according to the observed effect size - is that possible? Also, I would like to change the title of my X axis to 'Estimated Effect Size' rather than the default title 'Observed Outcome'. Lastly, would it be possible to specify the exact weight assigned to each study in the forest plot? Many thanks in advance for your help. MK