必要なパッケージインストール

pacman::p_load(tidyverse, metafor, meta, svglite)

CSV読み込み

Dataset <-read.csv("homework.csv",header=TRUE, sep=",")
head(Dataset)
##              Source N1 Event1 N2 Event2   N
## 1         Cook 1990 25     12 24     11  49
## 2 Conan McCaul 2003 35      6 36      4  71
## 3         Shin 2007 27      9 36     10  63
## 4         Shin 2007 26      5 35      4  61
## 5  Dabu-Bondoc 2012 30     14 32     20  62
## 6      Patel P 2013 87      9 75      7 162

前処理

データの統合と可視化(2値)

df1 <- Dataset %>% 
  mutate(pos.i = Event1, 
         pos.c = Event2, 
         total.i = N1,
         total.c = N2, 
         neg.i = N1 - Event1,
         neg.c = N2 - Event2)

統合と可視化 ~Forest plot~

効果量は、RR

異質性を推定する方法:DL法(DerSimonian-Laird法)を指定

ここでいうestimateは、対数化されているので、このままforest plotをしても、よくわからないので、atransf = expで対数を外している。

ラベルの修正

df2_label<- 
  meta::forest(df2,
               rightlabs = c("RR","95% CI","weight"),
               leftlabs = c("Author", "Event","N","Event","N"),
               lab.e = "PONV",
               pooled.totals = TRUE,
               smlab = "",
               text.random = "Random effect",
               print.tau2 = FALSE,
               col.diamond = "blue",
               col.diamond.lines = "black",
               print.I2.ci = TRUE,
               digits = 2)

既存レイアウトを使う方法

RevMan(コクラン)方式

df2_Revman5<- 
  meta::forest(df2,
               layout = "RevMan5",
               rightlabs = c("RR","95% CI","weight"),
               leftlabs = c("Author", "Event","N","Event","N"),
               lab.e = "PONV",
               pooled.totals = TRUE,
               smlab = "",
               text.random = "Random effect",
               print.tau2 = FALSE,
               col.diamond = "blue",
               col.diamond.lines = "black",
               print.I2.ci = TRUE,
               digits = 2)

既存レイアウトを使う方法

JAMA方式

df2_JAMA<- 
  meta::forest(df2,
               layout = "JAMA",
               rightlabs = c("RR","95% CI","weight"),
               leftlabs = c("Author", "Event","N","Event","N"),
               lab.e = "PONV",
               pooled.totals = TRUE,
               smlab = "",
               text.random = "Random effect",
               print.tau2 = FALSE,
               col.diamond = "blue",
               col.diamond.lines = "black",
               print.I2.ci = TRUE,
               digits = 2)

#funnel plotをmetafor packageで実施するために実施 ## 効果量の算出

df3 <- 
  escalc(measure="RR", 
         ai=pos.i,
         bi=neg.i, 
         ci=pos.c, 
         di=neg.c, 
         data = df1, 
         append=TRUE)

class(df3)
## [1] "escalc"     "data.frame"

Forest plotの出力(非表示)

統合と可視化 ~Funnel plot plot~

効果量は、RR

metafor::funnel(df4, 
                level=c(90, 95, 99), 
                shade=c("white", "gray", "darkgray"), 
                refline=0)

legend("topright",
       c("p > 0.1", "0.1 > p > 0.05", "0.05 > p > 0.01"),
       fill=c("white", "gray", "darkgray"))

左右対称性検定

左右対称性の検定は、閾値が狭いことがよく言われるので、有意水準は、10%にすることが多い。

Beggの方法

metafor::ranktest(df4)
## 
## Rank Correlation Test for Funnel Plot Asymmetry
## 
## Kendall's tau = 0.4222, p = 0.1083

左右対称性検定

左右対称性の検定は、閾値が狭いことがよく言われるので、有意水準は、10%にすることが多い。

Eggerの方法(回帰)

metafor::regtest(df4, model="lm")
## 
## Regression Test for Funnel Plot Asymmetry
## 
## Model:     weighted regression with multiplicative dispersion
## Predictor: standard error
## 
## Test for Funnel Plot Asymmetry: t = 2.2715, df = 8, p = 0.0528
## Limit Estimate (as sei -> 0):   b = -0.8342 (CI: -1.3992, -0.2691)