17 November 2023
Berikut ini adalah code R dari kelas Meta-analysis di Risetku Academy. Code berikut bisa dijalankan melalui RStudio (Download & Install RStudio here). Silakan copy-paste di RScript RStudio Anda!
#Install dan Load package terlebih dahulu
if (!require("remotes")) {
install.packages("remotes")
}
remotes::install_github("MathiasHarrer/dmetar")
library(meta)
#Load data dikotom untuk meta analisis
#Disediakan oleh package dmetar
data(DepressionMortality)
View(DepressionMortality)
#Lakukan pooling effect untuk data binary / dikotom
m.bin <- metabin(event.e = event.e,
n.e = n.e,
event.c = event.c,
n.c = n.c,
studlab = author,
data = DepressionMortality,
sm = "RR",
method = "MH",
fixed = TRUE,
random = TRUE,
method.tau = "PM",
title = "Depression and Mortality")
#Tampilkan hasil pooling size effect
summary(m.bin)
#Tampilkan forest plot
forest(m.bin)
#Heterogeneity
#Subgroup Analysis tidak dilakukan (K per grup <2)
#Meta-regresi tidak dilakukan (K per grup <2)
#Robustness
#Melakukan leave-one-out meta
m.bin.leave <- metainf(m.bin)
forest(m.bin.leave)
#Melakukan cumulative meta
m.bin.cum <- metacum(m.bin,
sortvar = -n.c)
forest(m.bin.cum)
#Menampilkan Funnel plot
funnel(m.bin)
#Menampilkan Bias Publikasi
metabias(m.bin,
method.bias = "Begg",
plotit = FALSE)
#Menampilkan Contour-enhanced Funnel plot
col.contour = c("gray75", "gray85", "gray95")
legend(x = 0.1, y = 0.1,
legend = c("p < 0.1", "p < 0.05", "p < 0.01"),
fill = col.contour)
funnel(m.bin,
studlab = FALSE,
xlim = c(0.05, 40),
contour = c(0.9, 0.95, 0.99),
col.contour = col.contour)
#Melakukan Trim-and-Fill analysis
m.bin.tf <- trimfill(m.bin)
summary(m.bin.tf)
#Menampilkan contour-enhanced Funnel plot + Trim-and-Fill analysis
funnel(m.bin.tf,
studlab = FALSE,
xlim = c(0.05, 40),
contour = c(0.9, 0.95, 0.99),
col.contour = col.contour)
#Install dan Load package terlebih dahulu
if (!require("remotes")) {
install.packages("remotes")
}
remotes::install_github("MathiasHarrer/dmetar")
library(meta)
#Load data untuk kontinu
#Disediakan oleh package dmetar
data(SuicidePrevention)
#Lakukan pooling effect untuk data kontinu
m.cont <- metacont(n.e = n.e,
mean.e = mean.e,
sd.e = sd.e,
n.c = n.c,
mean.c = mean.c,
sd.c = sd.c,
studlab = author,
data = SuicidePrevention,
sm = "MD",
fixed = FALSE,
random = TRUE,
method.tau = "SJ",
title = "Suicide Prevention")
#Tampilkan hasil pooling size effect
summary(m.cont)
#Menampilkan forest plot
forest(m.cont,
layout = "RevMan5")
##### Heterogenitas #####
#Subgroup analysis berdasarkan risiko bias
update.meta(m.gen,
subgroup = age_group)
#Meta regresi
m.cont.reg <- metareg(m.cont, ~pubyear)
m.cont.reg
bubble(m.cont.reg)
##### Robustness #####
#Melakukan leave-one-out meta
m.cont.leave <- metainf(m.cont)
forest(m.cont.leave)
#Melakukan cumulative meta
m.cont.cum <- metacum(m.cont,
sortvar = pubyear)
forest(m.cont.cum)
#Menampilkan Funnel plot
funnel(m.cont)
#Menampilkan Bias Publikasi
metabias(m.cont,
method.bias = "Egger",
plotit = FALSE)
#Dibatalkan: K<10
#Install dan Load package terlebih dahulu
if (!require("remotes")) {
install.packages("remotes")
}
remotes::install_github("MathiasHarrer/dmetar")
library(meta)
#Load data Generic IV untuk meta analisis
#Disediakan oleh package dmetar
data(ThirdWave)
#Lakukan pooling effect untuk data generic IV
#TE dalam SMD dan seTE adalah Standard error
m.gen <- metagen(TE = TE,
seTE = seTE,
studlab = Author,
data = ThirdWave,
sm = "SMD",
fixed = FALSE,
random = TRUE,
method.tau = "REML",
hakn = TRUE,
title = "Third Wave Psychotherapies")
#Tampilkan hasil pooling size effect
summary(m.gen)
#Tampilkan forest plot
forest(m.gen)
##### Heterogenitas #####
#Subgroup analysis berdasarkan risiko bias
update.meta(m.gen,
subgroup = RiskOfBias)
#Meta regresi
#Meta-regresi data kategorik
m.gen.reg <- metareg(m.gen, ~RiskOfBias)
summary(m.gen.reg)
bubble(m.gen.reg, studlab = TRUE)
#Meta-regresi data kontinu
#Karena pada data tidak ada variabel kontinu, kita tambahkan tahun publikasi
year <- c(2014, 1998, 2010, 1999, 2005, 2014,
2019, 2010, 1982, 2020, 1978, 2001,
2018, 2002, 2009, 2011, 2011, 2013)
m.gen.reg <- metareg(m.gen, ~year)
summary(m.gen.reg)
bubble(m.gen.reg, studlab = TRUE)
##### Robustness #####
#Melakukan leave-one-out meta
m.gen.leave <- metainf(m.gen)
forest(m.gen.leave)
#Melakukan cumulative meta
m.gen.cum <- metacum(m.gen,
sortvar = year)
forest(m.gen.cum)
##### Publication bias #####
#Menampilkan Funnel plot
funnel(m.gen)
#Menampilkan Bias Publikasi
metabias(m.gen,
method.bias = "Egger",
plotit = TRUE)
#Menampilkan Contour-enhanced Funnel plot
col.contour = c("gray75", "gray85", "gray95")
legend(x = 0.1, y = 0.1,
legend = c("p < 0.1", "p < 0.05", "p < 0.01"),
fill = col.contour)
funnel(m.gen,
studlab = FALSE,
contour = c(0.9, 0.95, 0.99),
col.contour = col.contour)
#Melakukan Trim-and-Fill analysis
m.gen.tf <- trimfill(m.gen)
summary(m.gen.tf)
#Menampilkan contour-enhanced Funnel plot + Trim-and-Fill analysis
funnel(m.gen.tf,
studlab = FALSE,
contour = c(0.9, 0.95, 0.99),
col.contour = col.contour)
Baca juga