簡體   English   中英

我如何使用 R 對百分比結果進行薈萃分析?

[英]How could I conduct meta-analysis on percentage outcomes using R?

我的示例數據如下:

df <- data.frame(study = c("Hodaie","Kerrigan","Lee","Andrade","Lim"), SR = c(0.5460, 0.2270, 0.7540, 0.6420, 0.5000), SE = c(12.30, 15.70, 12.80, 13.80, 9.00), Patients = c(5, 5, 3, 6, 4))

我想用SR(單組百分比),SE(我可以根據樣本量和百分比計算的標准誤差)和患者(每個研究的樣本量)進行薈萃分析,我希望我能得到以下結果forest plot(我在一篇文章中找到了這個例子,他們也有一組百分比數據,但我找不到他們使用的是哪個R語句或參數):

具有單組百分比結果的示例森林圖

誰能告訴我可以使用哪個 R 語句或論點來進行薈萃分析並生成上面的森林 plot? 謝謝!

我確信有很多方法可以使用包來完成此操作,但它可以在 base R 中完成(並且可能有更優雅的解決方案使用 base R)。 我這樣做的方法是首先構建一個比所需圖形部分大得多的空白 plot,然后在其上覆蓋相關元素。 我發現這樣可以更好地控制它。 下面是一個可以幫助您入門的基本示例。 如果您是 R 的新手(根據您的名字 NewRUser),我建議您逐行運行它以查看它是如何工作的。 同樣,這只是一種方法,可能還有更好的方法。 祝你好運!

樣本數據

#### Sample Data (modified from OP)
df <- data.frame(Study = c("Hodaie","Kerrigan","Lee","Andrade","Lim"), 
                 SR = c(0.5460, 0.2270, 0.7540, 0.6420, 0.5000), 
                 SE = c(12.30, 15.70, 12.80, 13.80, 9.00), 
                 Patients = c(5, 5, 3, 6, 4),
                 ci_lo = c(30, -8.0, 50, 37, 32),
                 ci_hi = c(78, 53, 100, 91, 67))
### Set up plotting elements
n.studies <- nrow(df)
yy <- n.studies:1
seqx <- seq(-100, 100, 50)

## blank plot much larger than needed
plot(range(-550, 200), range(0, n.studies), type = 'n', axes = F, xlab = '', ylab = '') #blank plot, much bigger than plotting portion needed
  
# Set up axes
  axis(side = 1, at = seqx, labels = seqx, cex.axis = 1, mgp = c(2, 1.5, 1)) # add axis and label (bottom)
  mtext(side = 1, at = 0, 'Seizure Reduction', line = 2.5, cex = 0.85, padj = 1) 
  axis(side = 3, at = seqx, labels = seqx, cex.axis = 1, mgp = c(2, 1.5, 1)) # add axis and label (top)
  mtext(side = 3, at = 0, 'Seizure Reduction', line = 2.5, cex = 0.85, padj = -1) 

## add lines and dots
 segments(df[, "ci_lo"], yy, df[,"ci_hi"], yy) # add lines
   points(df[,"SR"]*100, yy, pch = 19) # add points
   segments(x0 = 0, y0 = max(yy), y1 = 0, lty = 3, lwd = 0.75) #vertical line @ 0

### Add text information
  
 par(xpd = TRUE) 
  text(x = -550, y = yy, df[,"Study"], pos = 4)
  text(x = -450, y = yy, df[,"SR"]*100, pos = 4)
  text(x = -350, y = yy, df[,"SE"], pos = 4)
  text(x = -250, y = yy, df[,"Patients"], pos = 4)
  text(x = 150, y = yy, paste0(df[,"ci_lo"], "-", df[,"ci_hi"]), pos = 4)
  text(x = c(seq(-550, -250, 100), 150), y = max(yy)+0.75, 
       c(colnames(df)[1:4], "CI"), pos = 4, font = 2)

# Add legend
  legend(x = 50, y = 0.5, c("Point estimate", "95% Confidence interval"), 
         pch = c(19, NA), lty = c(NA, 19), bty = "n", cex = 0.65)

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM