[R] tweaking forest plot (metafor package)

Michael Dewey info at aghmed.fsnet.co.uk
Wed Jul 18 19:15:37 CEST 2012


At 00:10 18/07/2012, eesteves at ualg.pt wrote:
>Dear All,
>
>I'm having trouble tweaking a forest plot made using the R
>meta-analysis package metafor. I did the analysis based upon the
>correlation coeff from studies and plotted the corresponding forest
>plot easily
>
>>q2<-rma(yi,vi,mods=cbind(grupo),data=qim)
>>q2
>>forest (q2,transf=transf.ztor,digits=3, ... ,alim=c(0,1),refline=.5)
>>text(-1.55,42,"Espécie [refª]",pos=4,font=2)

Not sure why you use cbind(grupo) but it will not change much.


>I'd like to subdivide the "table" by the moderator 'grupo' - i.e.
>create the necessary spacings in the list of studies to accommodate
>the moderator statistics (cf.
>http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=metafor:addpoly.default).
>
>My main issue is that I cannot really understand how the function
>(forest()) really uses space; specifically, how to use the parameters
>'xlim', 'ylim' and 'rows' in the function? how can I change the scale
>from 0-1 to 0.5-1?

An example of what went wrong would help but I 
think you will find that the rows argument tells 
forest where to put the results of the individual 
trials so if you give it non-consecutive integers 
you will get gaps in the plot which you can fill 
with addpoly. So if rows does not contain 4 you 
can use addpoly to put something in row 4. As far 
as xlim and ylim are concerned my advice would be 
to try a whole range of values and see what 
happens as this is one of those cases where it is 
easier to experiment than to explain. If all else 
fails either (a) look at the code (b) wait for 
Wolfgang to ell you and me what really happens.

>Hopefully I've made myself (relatively) clear but... Thanks.
>
>Eduardo Esteves
>
>

Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html



More information about the R-help mailing list