[R-meta] modifying the default forest plot

Michael Dewey lists at dewey.myzen.co.uk
Sat Feb 17 14:39:07 CET 2018


Dear Mukht

When you fit the model try specifying slab there and see what happens.

Michael

On 16/02/2018 20:28, Mukht Kaur wrote:
> Hi Wolfgang,
> Here's how I fit the model:
> random <-rma(yi=effsiz, sei=se, data=mv3)
> 
> When I try to get the labels for author and year instead of Study 1, Study
> 2, in my forest plot, the statement used and error is shown below:
> 
> forest(random, showweights=TRUE, xlab='Estimated Effect Size',
> order="obs",slab=paste(random$author,random$year, sep=", "))
> Error in forest.rma(random, showweights = TRUE, xlab = "Estimated Effect
> Size",  :
>    Number of outcomes does not correspond to the length of the 'slab'
> argument.
> 
> Please let me know.
> 
> Thanks
> 
> On Tue, Dec 5, 2017 at 4:58 AM, Viechtbauer Wolfgang (SP) <
> wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
> 
>> 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
>>
> 
> 	[[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
> 

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



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