0

我正在使用 Metafor 包来生成元分析,然后是森林图。当我打印我的森林图时,会自动出现一个“RE 模型”文本,如附件打印所示。尽管我使用单独的文本脚本,但我无法弄清楚如何删除“RE 模型”。我只希望我的“自己的”文本与多边形对齐。你能帮我吗?

在此处输入图像描述

首先“加载数据”,然后是我的脚本:

### Load data
dat <- structure(list(study = structure(c(4L, 5L, 3L, 1L, 2L, 7L, 6L
), .Label = c("Battaglia et al.", "Hong et al.", "Kosyakove et al.", 
          "Lim et al.", "Rauch et al.", "Swachia et al.", "Tsounis et 
al."
), class = "factor"), n1i = c(20L, 121L, 25L, 18L, 31L, 35L, 
                          22L), m1i = c(12.8, 30.2, 24.6, 21, 25, 27, 
18.2), sd1i = c(15.4, 

21.6, 17, 33, 18, 13.8, 8.72), n2i = c(20L, 129L, 25L, 17L, 32L, 

34L, 20L), m2i = c(12.1, 28.7, 25.1, 31, 26, 28.6, 14.7), sd2i = c(14.6, 

21.6, 12.2, 25, 19, 24.2, 12.9), ntotal = c(40L, 250L, 50L, 35L, 

63L, 69L, 42L), mean.age = c(3L, 3L, 1L, 4L, 4L, 3L, 3L), demograhic = 
c(0L, 

2L, 1L, 1L, 0L, 1L, 0L), adjusted.comorbid = c(1L, 1L, 1L, 1L, 

0L, 1L, 1L), follow.up = c(1L, 3L, 3L, 1L, 2L, 2L, 2L), severity = c(2L, 

4L, 1L, 4L, 4L, 4L, 4L), treat.sys = c(1L, 2L, 1L, 2L, 1L, 2L, 

1L), treat.int = c(1L, 1L, 2L, 1L, 2L, 1L, 1L), year = c(2000L, 

2000L, 2000L, 2000L, 2000L, 2000L, 2000L), citation = c(1L, 2L, 

3L, 4L, 5L, 6L, 6L), yi = structure(c(0.700000000000001, 1.5, 

-0.5, -10, -1, -1.6, 3.5), measure = "MD", ni = c(40L, 250L, 

50L, 35L, 63L, 69L, 42L)), vi = c(22.516, 7.47261195464155, 17.5136, 

97.2647058823529, 21.7328629032258, 22.6658487394958, 11.7767909090909

)), .Names = c("study", "n1i", "m1i", "sd1i", "n2i", "m2i", "sd2i", 

"ntotal", "mean.age", "demograhic", "adjusted.comorbid", "follow.up", 

"severity", "treat.sys", "treat.int", "year", "citation", "yi", 

"vi"), row.names = c(NA, -7L), class = c("escalc", "data.frame"

), digits = 4, yi.names = "yi", vi.names = "vi")

和我的代码

### My code
res <- rma(yi, vi, data=dat, slab=paste(study, year, citation, sep=", "), method = "REML")
forest(res, xlim=c(-39,24), at=c(-12,-9,-6,-3,0,3,6,9,12), showweights = TRUE,
   ilab=cbind(dat$m1i, dat$n1i, dat$sd1i, dat$m2i, dat$n2i, dat$sd2i),
   ilab.xpos=c(-26,-24,-22,-18,-16,-14), cex=1, ylim=c(-2, 10), font=1, digits=2, col="darkgrey")

### Add own text
 text(-39, -2, pos=4, cex=0.9, font=2, 
 bquote(paste("Random-effects model for all studies: Q = ",
              .(formatC(q1$QE, digits=2, format="f")), 
              ", df = ", .(q1$k - q1$p),", p = ", 
              .(formatC(q1$QEp, digits=2, format="f")),
              ", ", I^2, " = ",
              .(formatC(q1$I2, digits=1, format="f")), 
              "%", ", ", tau^2 == 
                .(formatC(q1$tau2, digits=2, format="f")))))

先感谢您!

4

1 回答 1

2

要在左下角制作没有“RE 模型”文本的森林图,只需在函数调用中使用mlab = ""参数即可。forest

forest(res, xlim=c(-39,24), at=c(-12,-9,-6,-3,0,3,6,9,12), showweights = TRUE,
       ilab=cbind(dat$m1i, dat$n1i, dat$sd1i, dat$m2i, dat$n2i, dat$sd2i),
       ilab.xpos=c(-26,-24,-22,-18,-16,-14), cex=1, ylim=c(-2, 10), 
       font=1, digits=2, col="darkgrey", mlab = "")

在此处输入图像描述

q1不幸的是,由于您没有提供对象,因此我无法运行您提供的代码的“添加自己的文本”部分。但是你应该能够自己解决这个问题。

我使用 Metafor-Project 网站解决了这个问题,特别是他们在森林地块上的页面

于 2018-07-27T13:37:03.327 回答