# Install packages
if (!requireNamespace("data.table", quietly = TRUE)) {
install.packages("data.table")
}if (!requireNamespace("jsonlite", quietly = TRUE)) {
install.packages("jsonlite")
}if (!requireNamespace("metafor", quietly = TRUE)) {
install.packages("metafor")
}if (!requireNamespace("ggplotify", quietly = TRUE)) {
install.packages("ggplotify")
}
# Load packages
library(data.table)
library(jsonlite)
library(metafor)
library(ggplotify)
Funnel Plot (metafor)
Can be used to show potential bias factors in Meta-analysis.
Setup
System Requirements: Cross-platform (Linux/MacOS/Windows)
Programming language: R
Dependent packages:
data.table
;jsonlite
;metafor
;ggplotify
Data Preparation
# Load data
<- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/funnel-plot-metafor/data.json")$exampleData$textarea[[1]])
data <- as.data.frame(data)
data
# Convert data structure
<- escalc(ri=ri, ni=ni, data = data, measure="ZCOR")
data2 <- rma(yi, vi, data = data2)
res
# View data
head(data)
authors year ni ri controls design a_measure
1 Axelsson et al. 2009 109 0.187 none cross-sectional self-report
2 Axelsson et al. 2011 749 0.162 none cross-sectional self-report
3 Bruce et al. 2010 55 0.340 none prospective other
4 Christensen et al. 1999 107 0.320 none cross-sectional self-report
5 Christensen & Smith 1995 72 0.270 none prospective other
6 Cohen et al. 2004 65 0.000 none prospective other
c_measure meanage quality
1 other 22.00 1
2 NEO 53.59 1
3 NEO 43.36 2
4 other 41.70 1
5 NEO 46.39 2
6 NEO 41.20 2
Visualization
# Funnel Plot
<- as.ggplot(function(){
p funnel(x = res, main = "Funnel Plot (metafor)",
level = c(90, 95, 99), shade = c("white","#a90e07","#d23e0b"), refline = 0)
})
p
