r - 如何在 Metafor / R 的子组分析中显示权重?
问题描述
我已经制作了一个附在上面的森林图。
我已经申请showweights = TRUE
,这给了我每项研究的总体估计权重。
但是,我根据一些基本的研究特征进行了亚组分析。每个子组分析都会产生一个子组估计值。是否也可以显示子组估计的权重?
My data
q <- structure(list(study = structure(c(1L, 4L, 5L, 6L, 2L, 3L), .Label = c("Ho et al.", "Lee et al.", "Li et al. ", "Plontke et al.", "Wu et al.", "Xenellis et al."), class = "factor"), ai = c(11L, 6L, 24L, 9L, 10L, 9L), bi = c(4L, 5L, 3L, 10L, 11L, 15L), ci = c(7L, 5L, 6L, 0L, 4L, 0L), di = c(7L, 5L, 22L, 18L, 21L, 21L), year = c(2004L, 2009L, 2011L, 2006L, 2011L, 2010L), citation = structure(c(6L, 4L, 2L, 5L, 1L, 3L), .Label = c("[23]", "[24]", "[25]", "[26]", "[27]", "[28]"), class = "factor"), mod = c(1L, 1L, 0L, 0L, 1L, 0L), bias = c(1L, 0L, 0L, 1L, 1L, 1L), n1 = c(15L, 11L, 27L, 19L, 21L, 24L), n2 = c(14L, 10L, 28L, 18L, 25L, 21L), follow = c(0L, 0L, 0L, 1L, 1L, 1L)), .Names = c("study", "ai", "bi", "ci", "di", "year", "citation", "mod", "bias", "n1", "n2","follow"), class = "data.frame", row.names = c(NA, -6L))
我已经习惯了以下脚本:
library(metafor)
q <- escalc(measure="OR", ai=ai, bi=bi, ci=ci, di=di, data=q)
q1 <- rma(yi, vi, data=q, slab=paste(study, year, citation, sep=", "), method = "FE")
## Forest
forest(q1, xlim=c(-20,14), at=log(c(0.15,1,8,50,250)), atransf = exp, showweights = TRUE,
ilab=cbind(q$ai, q$bi, q$n1, q$ci, q$di, q$n2),
ilab.xpos=c(-11,-9.5,-8.0,-6,-4.5,-3), cex=1, ylim=c(-1, 18), font=1, digits=2, col="darkgrey",
order=order(q$mod),
rows=c(3.5:5.5,11.5:13.5),
xlab="Odds ratio ", mlab="")
text(-20, c(15,7), font=2, cex=1, pos=4, c("Severe to profound PTA at baseline","Moderate to severe PTA at baseline"))
text(-20, -0.5, pos=4, cex=1, font=2,
bquote(paste("Fixed-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=2, format="f")),
"%")))
# Headlines
text(c(-11,-9.5,-8.0,-6,-4.5,-3) ,16.5,font=3, cex=0.9, c(">10 dB", "<10 dB","Total", ">10 dB", "<10 dB","Total"))
text(c(-9.6,-5) ,17.5,font=2, cex=1, c("IT-Dex Salvage", "Control"))
text(-20 ,16.5,font=1,cex=0.9, "Author, year & reference", pos=4)
text(14 ,16.5,font=2, "Weight (%) and Odds ratio [95% CI]", pos=2, cex=0.9)
res.qq <- rma(ai=ai, bi=bi, ci=ci, di=di,
data=q, measure="OR",subset=(q$mod==0), method="FE")
res.qqq <- rma(ai=ai, bi=bi, ci=ci, di=di,
data=q, measure="OR",subset=(q$mod==1), method="FE")
addpoly(res.qq, row=2, cex=0.9, atransf=exp, mlab="Sum for moderate to severe")
addpoly(res.qqq, row= 10, cex=0.9, atransf=exp, mlab="Sum for severe to profound")
text(-20, 1, pos=4, cex=0.9, bquote(paste("Fixed-effects model: Q = ",
.(formatC(res.qq$QE, digits=2, format="f")),
", df = ", .(res.qq$k - res.qq$p),", p = ",
.(formatC(res.qq$QEp, digits=2, format="f")),
", ", I^2, " = ",
.(formatC(res.qq$I2, digits=2, format="f")),
"%")))
text(-20, 9, pos=4, cex=0.9, bquote(paste("Fixed-effects model: Q = ",
.(formatC(res.qqq$QE, digits=2, format="f")),
", df = ", .(res.qqq$k - res.qqq$p),", p = ",
.(formatC(res.qqq$QEp, digits=2, format="f")),
", ", I^2, " = ",
.(formatC(res.qqq$I2, digits=2, format="f")),
"%")))
解决方案
推荐阅读
- javascript - 将对象实例的方法赋值给变量然后调用是非法调用
- google-app-maker - Appmaker 输入表单,根据之前的下拉选项更改选项
- c++ - Bazel - 导入静态库时包括目录中的所有标题
- c++ - 在过滤期间展开树视图中的特定项目
- ember.js - 为什么“hasMany”关系会为关系中的每个项目创建一个 OPTIONS 和 GET 请求?
- python - 数据迁移导致错误 AttributeError: type object 'User' has no attribute 'normalize_username'?
- java - 如何为嵌入式 Flume 代理实现自定义接收器?
- javascript - 通过 Promise 将 Node js 连接到 Mongo Atlas
- html - 如何创建具有两行元素而不是一行的侧滚动条?
- vue.js - 如何使组件使用 v-for 具有动态插槽