[R-meta] Putting pooled effects from different multilevel meta analyses into the same forest plot

Michael Dewey ||@t@ @end|ng |rom dewey@myzen@co@uk
Wed Dec 23 13:04:35 CET 2020


Dear Dylan

Looking at the documentation for forest.default I see no parameter 
plotwidth so it is being passed to any functions called within that use 
the ... argument. What exactly are you trying to achieve here?

Michael

On 23/12/2020 00:54, Dylan Johnson wrote:
> Hello,
> 
> 
> 
> Is there any reason that the plotwidth function isn�t working with the following forest plot:
> 
> 
> 
> dev.new(width=10, height=1)
> 
> forest(c(coef(m.overall), coef(m.overall2), coef(m.overall3)),
> 
>         c(vcov(m.overall), vcov(m.overall2), round(vcov(m.overall3), digits = 3)),
> 
>         slab=c("Threat (k=39)", "Deprivation (k=45)", "Composite (k=125)"),
> 
>         header=c("Inhibitory Control", "Hedge's g [95% CI]"), xlab="Hedge's g",
> 
>         top=2, refline=NA, xlim=c(-3.2,1), at=(c(0,-0.25,-0.50,-0.75)), psize=1, efac=0, plotwidth=unit(6, "cm") )
> 
> addpoly(c(coef(m.overall), coef(m.overall2), coef(m.overall3)),
> 
>          c(vcov(m.overall), vcov(m.overall2), vcov(m.overall3)),
> 
>          rows=3:1, efac=2, annotate=FALSE, col = 2, border = 2)
> 
> 
> 
> It doesn�t seem to change the width of the forest plot no matter what values I type in.
> 
> 
> 
> Thank you
> 
> 
> 
> Dylan Johnson, MSc
> 
> MA Student, School and Clinical Child Psychology
> Department of Applied Psychology and Human Development
> 
> University of Toronto
> 252 Bloor Street West
> 
> Toronto, ON M5S 1V6
> 
> 
> 
> From: Viechtbauer, Wolfgang (SP)<mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
> Sent: December 21, 2020 10:55 AM
> To: Michael Dewey<mailto:lists using dewey.myzen.co.uk>; Dylan Johnson<mailto:dylanr.johnson using mail.utoronto.ca>
> Cc: r-sig-meta-analysis using r-project.org<mailto:r-sig-meta-analysis using r-project.org>
> Subject: RE: [R-meta] Putting pooled effects from different multilevel meta analyses into the same forest plot
> 
> 
> 
> EXTERNAL EMAIL:
> 
> As Michael suggested. Or, if you install the 'devel' version of metafor, then 'col' will also take a vector of colors in addpoly().
> 
> Best,
> Wolfgang
> 
>> -----Original Message-----
>> From: Michael Dewey [mailto:lists using dewey.myzen.co.uk]
>> Sent: Monday, 21 December, 2020 10:54
>> To: Dylan Johnson; Viechtbauer, Wolfgang (SP)
>> Cc: r-sig-meta-analysis using r-project.org
>> Subject: Re: [R-meta] Putting pooled effects from different multilevel meta
>> analyses into the same forest plot
>>
>> Dear Dylan
>>
>> Perhaps plot them one at a time?
>>
>> Michael
>>
>> On 20/12/2020 22:46, Dylan Johnson wrote:
>>> Apologies for not CC-ing the mailing list.
>>>
>>> As a last question, is there a way for me to make each of these polygons a
>> different colour as opposed to all the same:
>>>
>>> forest(c(coef(m.overall), coef(m.overall2), coef(m.overall3)),
>>>          c(vcov(m.overall), vcov(m.overall2), round(vcov(m.overall3),
>> digits = 3)),
>>>          slab=c("Threat (k=23)", "Deprivation (k=14)", "Composite (k=77)"),
>>>          header=c("Cognitive Flexibility", "Hedge's g [95% CI]"),
>> xlab="Hedge's g",
>>>          top=2, refline=NA, xlim=c(-3,1), at=log(c(.2, .5, 1)), psize=1,
>> efac=0)
>>>
>>> addpoly(c(coef(m.overall), coef(m.overall2), coef(m.overall3)),
>>>           c(vcov(m.overall), vcov(m.overall2), vcov(m.overall3)),
>>>           rows=3:1, efac=2, annotate=FALSE, col = 2)
>>>
>>> Dylan Johnson, MSc
>>>
>>> MA Student, School and Clinical Child Psychology
>>> Department of Applied Psychology and Human Development
>>>
>>> University of Toronto
>>> 252 Bloor Street West
>>>
>>> Toronto, ON M5S 1V6
>>>
>>> From: Viechtbauer, Wolfgang
>> (SP)<mailto:wolfgang.viechtbauer using maastrichtuniversity.nl>
>>> Sent: December 20, 2020 3:26 PM
>>> To: Dylan Johnson<mailto:dylanr.johnson using mail.utoronto.ca>
>>> Cc: R meta<mailto:r-sig-meta-analysis using r-project.org>
>>> Subject: RE: Putting pooled effects from different multilevel meta
>> analyses into the same forest plot
>>>
>>> Please always cc the mailing list when replying.
>>>
>>> You could use addpoly() to draw the polygons on top. Continuing with the
>> example:
>>>
>>> addpoly(c(coef(res.r), coef(res.n), coef(res)),
>>>           c(vcov(res.r), vcov(res.n), vcov(res)),
>>>           rows=3:1, efac=2, annotate=FALSE)
>>>
>>> Best,
>>> Wolfgang
>>>
>>>> -----Original Message-----
>>>> From: Dylan Johnson [mailto:dylanr.johnson using mail.utoronto.ca]
>>>> Sent: Sunday, 20 December, 2020 20:38
>>>> To: Viechtbauer, Wolfgang (SP)
>>>> Subject: RE: Putting pooled effects from different multilevel meta
>> analyses
>>>> into the same forest plot
>>>>
>>>> Thanks for the script, I managed to get it working!
>>>>
>>>> Do you know if there is any way to get them to show up with the diamond
>>>> shape plotted instead of the squares? They are technically pooled effects
>> so
>>>> I think it would hammer that home better.
>>>>
>>>> Thanks!
>>>>
>>>> Dylan
>>>>
>>>> Dylan Johnson, MSc
>>>> MA Student, School and Clinical Child Psychology
>>>> Department of Applied Psychology and Human Development
>>>> University of Toronto
>>>> 252 Bloor Street West
>>>> Toronto, ON M5S 1V6
>>>>
>>>> From: Viechtbauer, Wolfgang (SP)
>>>> Sent: December 20, 2020 6:59 AM
>>>> To: Dylan Johnson; r-sig-meta-analysis using r-project.org
>>>> Subject: RE: Putting pooled effects from different multilevel meta
>> analyses
>>>> into the same forest plot
>>>>
>>>> Hi Dylan,
>>>>
>>>> Here is an example using rma(), but the same principle applies to models
>>>> fitted with rma.mv().
>>>>
>>>> dat <- dat.bcg
>>>> dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat)
>>>> res   <- rma(yi, vi, data=dat)
>>>> res.r <- rma(yi, vi, data=dat, subset=alloc=="random")
>>>> res.n <- rma(yi, vi, data=dat, subset=alloc!="random")
>>>>
>>>> dev.new(width=10, height=6)
>>>> forest(c(coef(res.r), coef(res.n), coef(res)),
>>>>         c(vcov(res.r), vcov(res.n), vcov(res)),
>>>>         slab=c("With Random Assignment", "Without Random Assignment", "All
>>>> Studies"),
>>>>         header=c("Subset", "Risk Ratio [95% CI]"), xlab="Risk Ratio (log
>>>> scale)",
>>>>         top=2, refline=NA, xlim=c(-3,1), atransf=exp, at=log(c(.2, .5,
>> 1)),
>>>> psize=1, efac=0)
>>>>
>>>> Best,
>>>> Wolfgang
>>>>
>>>>> -----Original Message-----
>>>>> From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-
>>>> project.org]
>>>>> On Behalf Of Dylan Johnson
>>>>> Sent: Sunday, 20 December, 2020 2:01
>>>>> To: r-sig-meta-analysis using r-project.org
>>>>> Subject: [R-meta] Putting pooled effects from different multilevel meta
>>>>> analyses into the same forest plot
>>>>>
>>>>> Hello,
>>>>>
>>>>> I am currently using the rma.mv function to carry out my metas and would
>>>>> like to display two pooled subgroups from one of them and an additional
>>>>> pooled estimate from another.
>>>>>
>>>>> Is there anyways to go about doing this?
>>>>>
>>>>> Many thanks!
>>>>>
>>>>> Dylan
>>>>>
>>>>> Dylan Johnson, MSc
>>>>>
>>>>> MA Student, School and Clinical Child Psychology
>>>>> Department of Applied Psychology and Human Development
>>>>>
>>>>> University of Toronto
>>>>> 252 Bloor Street West
>>>>>
>>>>> Toronto, ON M5S 1V6
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> 
> _______________________________________________
> R-sig-meta-analysis mailing list
> R-sig-meta-analysis using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
> 

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-sig-meta-analysis mailing list