Skip to content

Instantly share code, notes, and snippets.

@dsquintana
Last active August 10, 2018 03:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsquintana/b4a80de22ce14c4ab73c443f334ee83a to your computer and use it in GitHub Desktop.
Save dsquintana/b4a80de22ce14c4ab73c443f334ee83a to your computer and use it in GitHub Desktop.
An R script to generate various contour-enhanced funnel plots
### Contour-enhanced funnel plots using metafor ###
# Load metafor package
library("metafor")
# Load dataset
dat <- get(data(dat.molloy2014))
# Calculate r-to-z transformed correlations and corresponding sampling variances
dat <- escalc(measure="ZCOR", ri=ri, ni=ni, data=dat) #
# meta-analysis of the transformed correlations
res <- rma(yi, vi, data=dat)
res
# Standard funnel plot (Plot A)
funnel(res)
# Standard contour-enhanced funnel plot (Plot B)
funnel(res, refline=0, level=c(90, 95, 99),
shade=c("white", "gray", "darkgray"))
# Contour-enhanced funnel plot with colour (Plot C)
funnel(res, refline=0, level=c(90, 95, 99),
shade=c("white", "red", "orange"))
# Contour-enhanced funnel plot with adjusted significance levels (Plot C)
funnel(res, refline=0, level=c(95, 99),
shade=c("white", "red"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment