# Install packages
if (!requireNamespace("data.table", quietly = TRUE)) {
install.packages("data.table")
}if (!requireNamespace("jsonlite", quietly = TRUE)) {
install.packages("jsonlite")
}if (!requireNamespace("FunnelPlotR", quietly = TRUE)) {
install.packages("FunnelPlotR")
}if (!requireNamespace("gridExtra", quietly = TRUE)) {
install.packages("gridExtra")
}
# Load packages
library(data.table)
library(jsonlite)
library(FunnelPlotR)
library(gridExtra)
Funnel Plot
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
;FunnelPlotR
;gridExtra
Data Preparation
# Load data
<- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/funnel-plot/data.json")$exampleData$textarea[[1]])
data <- as.data.frame(data)
data
# View data
head(data)
los hmo white died age80 type type1 type2 type3 provnum prds
1 4 0 1 0 0 1 1 0 0 30001 9.667315
2 9 1 1 0 0 1 1 0 0 30001 8.956472
3 3 1 1 1 1 1 1 0 0 30001 6.856678
4 9 0 1 0 0 1 1 0 0 30001 9.667315
5 1 0 1 1 1 1 1 0 0 30001 7.400868
6 4 0 1 1 0 1 1 0 0 30001 7.561051
Visualization
# Funnel Plot
<- funnel_plot(
p numerator = los, denominator = prds, group = provnum, data_type = "SR",
data, limit = 99, label = "outlier", sr_method = "SHMI", trim_by=0.1,
title = "Funnel Plot", x_range = "auto", y_range = "auto"
)
p
A funnel plot object with 54 points of which 9 are outliers.
Plot is adjusted for overdispersion.
