Funnel Plot

Authors

[Editor] Hu Zheng;

[Contributors]

Modified

2026-01-17

Note

Hiplot website

This page is the tutorial for source code version of the Hiplot Funnel Plot plugin. You can also use the Hiplot website to achieve no code ploting. For more information please see the following link:

https://hiplot.cn/basic/funnel-plot?lang=en

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

# 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)
sessioninfo::session_info("attached")
─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.5.2 (2025-10-31)
 os       Ubuntu 24.04.3 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       UTC
 date     2026-01-17
 pandoc   3.1.3 @ /usr/bin/ (via rmarkdown)
 quarto   1.8.27 @ /usr/local/bin/quarto

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 data.table  * 1.18.0  2025-12-24 [1] RSPM
 FunnelPlotR * 0.6.0   2025-07-23 [1] RSPM
 gridExtra   * 2.3     2017-09-09 [1] RSPM
 jsonlite    * 2.0.0   2025-03-27 [1] RSPM

 [1] /home/runner/work/_temp/Library
 [2] /opt/R/4.5.2/lib/R/site-library
 [3] /opt/R/4.5.2/lib/R/library
 * ── Packages attached to the search path.

──────────────────────────────────────────────────────────────────────────────

Data Preparation

# Load data
data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/funnel-plot/data.json")$exampleData$textarea[[1]])
data <- as.data.frame(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
p <- funnel_plot(
  data, numerator = los, denominator = prds,  group = provnum, data_type = "SR",
  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. 
FigureΒ 1: Funnel Plot