私の理解が正しければ、あなたはこれらの約 90 の調査でいくつかの分析を行っており (たとえば、さまざまなサブセットに基づいて)、フォレスト プロットで (これらの分析に基づいて) 要約推定値のみを表示することを目標としています。次に、最も簡単な方法は、さまざまな分析の推定値と対応する分散をベクトルで収集し、それをforest()
関数に渡すことです。簡単な例を挙げましょう。
### load metafor package
library(metafor)
### load BCG vaccine dataset
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)
### fit random-effects models to some subsets
res.r <- rma(yi, vi, data=dat, subset=alloc=="random")
res.s <- rma(yi, vi, data=dat, subset=alloc=="systematic")
res.a <- rma(yi, vi, data=dat, subset=alloc=="alternate")
### collect model estimates and corresponding variances
estimates <- c(coef(res.r), coef(res.s), coef(res.a))
variances <- c(vcov(res.r), vcov(res.s), vcov(res.a))
### create vector with labels
labels <- c("Random Allocation", "Systematic Allocation", "Alternate Allocation")
### forest plot
forest(estimates, variances, slab=labels)
ポイント サイズの違いが気に入らない場合 (デフォルトでは、分散に反比例して描画されます)、次を使用できます。
forest(estimates, variances, slab=labels, psize=1)
その他の改善点:
forest(estimates, variances, slab=labels, psize=1, atransf=exp, xlab="Relative Risk (log scale)", at=log(c(.2, .5, 1, 2)))
補遺
見積もりに多角形を好む場合は、次のようにすることができます。最初に上記のようにプロットを描画しますがefac=0
、CI の垂直線を非表示にするために使用します。次に、次のように要約ポリゴンを描画しますaddpoly()
。
forest(estimates, variances, slab=labels, psize=1, atransf=exp, xlab="Relative Risk (log scale)", at=log(c(.2, .5, 1, 2)), efac=0)
addpoly(estimates, variances, atransf=exp, rows=3:1, col="white", annotate=FALSE)
efac=1.5
in を使用しaddpoly()
て、ポリゴンを垂直方向に引き伸ばすこともできます。好みに合わせて係数を調整してください。