metafor:省略森林图中的研究
metafor: omitting studies in a forest plot
我想从森林图中省略一些标准误差很大的研究,因为它们很难解释。但我不想改变估计。下面是一个玩具示例:
### load BCG vaccine data
data(dat.bcg)
### meta-analysis of the log relative risks using a random-effects model
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,
slab=paste(author, year, sep=", "))
### Let's say I want to omit the first study, the rows argument doesn't work as expected
forest(res, rows = c(2:13))
Error in forest.rma(res, rows = c(2:13)) :
Number of outcomes does not correspond to the length of the 'rows' argument.
有什么想法吗?
您可以使用 forest()
构建森林图,将估计值和相应的抽样方差传递给函数。使用 subset
参数,您可以省略不想包含在图中的研究。然后将基于模型(使用完整数据集)的汇总估计添加到 addpoly()
的图中。使用玩具示例:
### load BCG vaccine data
data(dat.bcg)
### load BCG vaccine data
data(dat.bcg)
### calculate log relative risks and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg,
data=dat.bcg, slab=paste(author, year, sep=", "))
### meta-analysis of the log relative risks using a random-effects model
res <- rma(yi, vi, data=dat)
res
### forest plot of all studies
forest(dat$yi, dat$vi, ylim=c(-1.5,16))
addpoly(res, row=-1)
abline(h=0)
### forest plot omitting 1st study
forest(dat$yi, dat$vi, ylim=c(-1.5,15), subset=-1)
addpoly(res, row=-1)
abline(h=0)
我想从森林图中省略一些标准误差很大的研究,因为它们很难解释。但我不想改变估计。下面是一个玩具示例:
### load BCG vaccine data
data(dat.bcg)
### meta-analysis of the log relative risks using a random-effects model
res <- rma(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg,
slab=paste(author, year, sep=", "))
### Let's say I want to omit the first study, the rows argument doesn't work as expected
forest(res, rows = c(2:13))
Error in forest.rma(res, rows = c(2:13)) :
Number of outcomes does not correspond to the length of the 'rows' argument.
有什么想法吗?
您可以使用 forest()
构建森林图,将估计值和相应的抽样方差传递给函数。使用 subset
参数,您可以省略不想包含在图中的研究。然后将基于模型(使用完整数据集)的汇总估计添加到 addpoly()
的图中。使用玩具示例:
### load BCG vaccine data
data(dat.bcg)
### load BCG vaccine data
data(dat.bcg)
### calculate log relative risks and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg,
data=dat.bcg, slab=paste(author, year, sep=", "))
### meta-analysis of the log relative risks using a random-effects model
res <- rma(yi, vi, data=dat)
res
### forest plot of all studies
forest(dat$yi, dat$vi, ylim=c(-1.5,16))
addpoly(res, row=-1)
abline(h=0)
### forest plot omitting 1st study
forest(dat$yi, dat$vi, ylim=c(-1.5,15), subset=-1)
addpoly(res, row=-1)
abline(h=0)