[R] forest plot metafor

Michael Dewey lists at dewey.myzen.co.uk
Fri Dec 11 14:46:46 CET 2015


See below

On 09/12/2015 18:48, Mario Petretta wrote:
> Dear all,
>
>
>
> I use metafor package to generate a forest plot showing the weight of each study in the plot.
>
>
>
> I use the code:
>
> library(metafor)
>
> data(dat.bcg)
>
> res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
>
>             slab=paste(author, year, sep=", "), method="REML")
>
> forest(res, showweights=TRUE)
>
>
>
> It is possible to order the columns, placing the weights after effect size and CI?
>

There are some fairly extensive examples in the forest.rma 
documentation. You will also need some patience to get everything 
exactly where you want it and looking exactly how you want. Graphics are 
like that.

>
>
> A further query: using escalc (or rma), it is possible to add the weight of each study (other than yi and vi) to the data (in the example: data.bcg)?
>

You can extract the weights from the fitted object using weights.ram.uni 
and put them in the data  frame yourself. I am a bit worried about your 
mention of escalc, you do realise that the weights are a function of the 
fit, not the data?

So weights(res) should be OK here (not tested).

>
>
> Thanks for your attention
>
>
>
> ________________________
>
>
>
> Mario Petretta
>
> Professor of Internal Medicine
>
> Department of Translational Medical Science
>
> Naples University “Federico II” - Italy
>
>
>
>
>
>    _____
>
>
>   <http://www.avast.com/>
>
> Questa e-mail è priva di virus e malware perché è attiva la protezione avast! Antivirus <http://www.avast.com/>  .
>
>
>
> Nessun virus nel messaggio.
> Controllato da AVG - www.avg.com
> Versione: 2014.0.4259 / Database dei virus: 3705/7093 - Data di rilascio: 14/02/2014
>
>
>
> ---
> Questa e-mail è stata controllata per individuare virus con Avast antivirus.
> https://www.avast.com/antivirus
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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



More information about the R-help mailing list