[R] R: forest plot metafor
petretta at unina.it
Mon Dec 14 10:13:17 CET 2015
Many tanks to Wolfgang Viechtbauer for his time and help.
The suggested code works very well
Date: Sat, 12 Dec 2015 17:22:20 +0100
From: "Viechtbauer Wolfgang (STAT)"
<wolfgang.viechtbauer a maastrichtuniversity.nl>
To: "r-help a r-project.org" <r-help a r-project.org>
Subject: Re: [R] R: forest plot metafor
<077E31A57DA26E46AB0D493C9966AC730F2460CD18 a 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:
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)
forest(res, xlim=c(-7,8), digits=c(2,0))
mtext(wi, side=4, at=13:1, line=4, las=2, adj=1)
Adjust as needed for your data.
From: R-help [r-help-bounces a r-project.org] On Behalf Of Mario Petretta [petretta a unina.it]
Sent: Saturday, December 12, 2015 3:57 PM
To: r-help a 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:
it is possible to directly order the columns, simply placing the weights after effect size and CI?
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
More information about the R-help