[R-meta] forest plot using metafor: how to add CIs as line segments
Sophia Kyriakou
sophia.kyriakou17 at gmail.com
Thu Aug 17 00:36:11 CEST 2017
Hi Wolfgang,
Thanks for this, this is exactly what I asked for. Because I want to report
confidence intervals computed using approaches that do not estimate the
model parameters.
For this reason I would also like to delete the -2.80 values on the last
three rows of the right column so that only the confidence intervals are
reported and the estim$pred are not.
Does forest() allow that?
On Wed, Aug 16, 2017 at 11:26 PM, Viechtbauer Wolfgang (SP) <
wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
> Hi Sophia,
>
> I am not 100% sure if I understand what you want, but try:
>
> forest(..., efac=c(1,0))
>
> and
>
> addpoly(..., efac=0)
>
> and see if this is what you want.
>
> By the way, you do not have to use forest.rma() -- using forest() is
> sufficient.
>
> Best,
> Wolfgang
>
> --
> Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and
> Neuropsychology | Maastricht University | P.O. Box 616 (VIJV1) | 6200 MD
> Maastricht, The Netherlands | +31 (43) 388-4170 | http://www.wvbauer.com
>
> -----Original Message-----
> From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-
> bounces at r-project.org] On Behalf Of Sophia Kyriakou
> Sent: Wednesday, August 16, 2017 22:51
> To: r-sig-meta-analysis at r-project.org
> Subject: [R-meta] forest plot using metafor: how to add CIs as line
> segments
>
> Hello,
>
> At the moment I have a forest plot obtained using the following code chunk.
>
> data <- data.frame(y = c(-1.90, 1.00, -3.50, -5.90, -4.00),
> sigma2 = c(0.34, 0.84, 1.37, 1.37, 0.28),
> author = c("Study 1","Study 2","Study 3","Study 4","Study 5"))
> estim <- data.frame(pred = c(-2.80,-2.80),LRlow = c(-4.78,-5.26),LRup =
> c(-0.82,-0.40))
>
> library(metafor)
> res <- rma(y, sigma2, data=data, method = "ML")
> forest.rma(res, xlim=c(-23, 15), at=seq(-10,4,2), slab=data$author,
> ylim=c(-3, 8), xlab="Change in DBP", mlab="")
> text(par("usr")[2], 7, pos=2, "DBP Change, [95% CI]", font=2)
> text(par("usr")[1], -1, pos=4, "ML")
> addpoly(estim$pred, ci.lb=estim$LRlow, ci.ub=estim$LRup, rows=-2,
> mlab=c("DL", "DR"))
>
> I would like to change the diamonds that represent confidence intervals
> into horizontal line segments, indicating the lower and upper limits of the
> confidence interval. I am not interested in showing the estimated overall
> effect of the model.
> Is that possible?
>
> Thanks in advance.
>
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list