Many tanks to Wolfgang Viechtbauer for his time and help.

The suggested code works very well

Mario Petretta.

__________________________________________________________________________________
Message: 11
Date: Sat, 12 Dec 2015 17:22:20 +0100
From: "Viechtbauer Wolfgang (STAT)"
        <wolfgang.viechtba...@maastrichtuniversity.nl>
To: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] R:  forest plot metafor
Message-ID:
        <077e31a57da26e46ab0d493c9966ac730f2460c...@um-mail4112.unimaas.nl>
Content-Type: text/plain; charset="us-ascii"

No, this is not possible. But you can just add the weights yourself. One 
difficulty here is that you want the weights to the right of the estimates and 
corresponding CIs and those are always placed at the right of the figure. One 
possibility would be to make the right margin large and then use mtext() to 
place the weights in that margin. An example:

library(metafor)
data(dat.bcg)
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
res <- rma(yi, vi, data=dat, method="FE")
wi <- formatC(weights(res), format="f", digits=1, width=4)
par(mar=c(5,4,4,6))
forest(res, xlim=c(-7,8), digits=c(2,0))
mtext(wi, side=4, at=13:1, line=4, las=2, adj=1)
par(xpd=TRUE)
abline(h=c(0,14))
par(xpd=FALSE)

Adjust as needed for your data.

Best,
Wolfgang
________________________________________
From: R-help [r-help-boun...@r-project.org] On Behalf Of Mario Petretta 
[petre...@unina.it]
Sent: Saturday, December 12, 2015 3:57 PM
To: r-help@r-project.org
Subject: [R] R:  forest plot metafor

Many thanks to Professor Michael Dewey for his time.

I apologize for the error about the claim to obtain weights from escalc and I 
realise that the weights are a function of the fit, not the data.

weights(res) is OK to extract the weights from the fitted object and to put 
them in the data  frame.

However, I again ask:

Using:

 forest(res, showweights=TRUE)

it is possible to directly order the columns, simply placing the weights after 
effect size and CI?

Sincerely

Mario Petretta



---
Questa e-mail รจ stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus

______________________________________________
R-help@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.

Reply via email to