viz_funnel: Funnel plot variants for meta-analysis

Description Usage Arguments Details Value Author(s) References Examples

View source: R/viz_funnel.R


Creates a funnel plot. Many options regarding the appearance and statistical information displayed are provided (e.g., significance contours, additional evidence contours, and trim-and-fill analysis).


  group = NULL,
  y_axis = "se",
  method = "FE",
  contours = TRUE,
  sig_contours = TRUE,
  addev_contours = FALSE,
  contours_col = "Blues",
  contours_type = "FEM",
  detail_level = 1,
  egger = FALSE,
  trim_and_fill = FALSE,
  trim_and_fill_side = "left",
  text_size = 3,
  point_size = 2,
  xlab = "Effect",
  ylab = NULL,
  group_legend = FALSE,
  group_legend_title = "",
  x_trans_function = NULL,
  x_breaks = NULL



data.frame or matrix with the effect sizes of all studies (e.g., correlations, log odds ratios, or Cohen d) in the first column and their respective standard errors in the second column. Alternatively, x can be the output object of function rma.uni from package metafor; then effect sizes and standard errors are extracted from x.


factor indicating the subgroup of each study to show in the funnel plot. Has to be in the same order than x.


character string indicating which y axis should be used in the funnel plot. Available options are "se" (default) for standard error and "precision" for the reciprocal of the standard error.


character string indicating the method used to compute the meta-analytic summary effect and, for a random effects model, the between-study variance tau squared. Can be any method argument from rma.uni (e.g., "FE" for the fixed effect model, or "DL" for the random effects model using the DerSimonian-Laird method to estimate tau squared). If input x is an output object of function rma.uni from package metafor, then the method is extracted from x.


logical scalar indicating if classic funnel plot confidence contours and the summary effect should be displayed.


logical scalar. Should significance contours be drawn (at the 0.05 or 0.01 level using a Wald test)?


logical scalar. Should approximate additional evidence contours be drawn, showing the significance of the updated summary effect? See Details. Note: For method other than "FE" or "DL" runtime is increased significantly. Consider reducing detail_level.


character string indicating the color palette used from package RColorBrewer for sig_contours, and addev_contours. Can be any of "Blues", "Greys", "Oranges", "Greens", "Reds", and "Purples".


character string indicating how confidence contours are computed. Must be either "FEM" or "REM". If contours_type is set to "FEM" (default), contours are given as M +/- qnorm(0.975)*SE, with M the meta-analytic summary effect and SE the study standard error. If contours_type is set to "REM", contours are given as M +/- qnorm(0.975)*sqrt(SE^2 + tau squared), with M again the meta-analytic summary effect, SE the study standard error and tau squared the esimated between study heterogeneity from a random effects model. The argument of contours_type has no effect if tau squared is zero.


numeric scalar. Allows to increase or decrease the plotting detail of contours. Values can be chosen between 0.1 and 10. Default is 1.


logical scalar. Should Egger's regression line be drawn? Only available if y_axis is "se".


logical scalar. Should studies imputed by the trim and fill method be displayed? Also shows the adjusted summary effect if contours is TRUE as well.


character string indicating on which side of the funnel plot studies should be imputed by the trim and fill method (i.e., on which side are studies presumably missing due to publication bias). Must be either "right" or "left" (default).


numeric value. Size of text in the funnel plot. Default is 3.


numeric value. Size of the study points in the funnel plot. Default is 2.


character string specifying the label of the x axis.


character string specifying the label of the y axis.


logical scalar. Should there be a legend shown at the bottom of the graph if group was supplied?


a character string specifying the title of the legend if group was supplied and group_legend is TRUE.


function to transform the labels of the x axis. Common uses are to transform log-odds-ratios or log-risk-ratios with exp to their original scale (odds ratios and risk ratios), or Fisher's z values back to correlation coefficients using tanh.


numeric vector of values for the breaks on the x-axis. When used in tandem with x_trans_function the supplied values should be not yet transformed.


The funnel plot is a widely used diagnostic plot in meta-analysis to assess small study effects and in particular publication bias. The function viz_funnel is capable to create a large set of different funnel plot variants. Options for several graphical augmentations (e.g., confidence, significance, and additional evidence contours; choice of the ordinate; study subgroups), and different statistical information displayed are provided (Egger's regression line, and imputed studies by, as well as the adjusted summary effect from, the trim-and-fill method).


Three different contours are available in viz_funnel:

  1. confidence contours (argument contours) show the region where one expects 95% of all studies to fall (assuming the meta-analytic model applied is true and all estimates are identical to the parameters of interest). Confidence contours can help to assess the plausibility of observations given the meta-analytic model specified (fixed effect or random effects model).

  2. significance contours (argument sig_contours) show shaded regions of individual study significance at the 5% and 1% level (using the standard errors supplied and a Wald test). Significance contours were proposed to help distinguish publication bias from other sources of funnel plot asymmetry (Peters, Sutton, Jones, Abrams, & Rushton, 2008).

  3. additional evidence contours: Significance of the summary effect (argument addev_contours). These contours define regions where a new study has to fall such that the updated meta-analytic summary effect is significantly different from zero or not (using a two-sided test and an alpha level of 5%). Additional evidence contours allow to assess the robustness of the meta-analysis with respect to the effect of potentially new published evidence on the significance of the meta-analytic summary effect (Langan, Higgins, Gregory, & Sutton, 2012).

Measure on the y-axis

Two different options for the y-axis choice are available. First, to plot the standard errors on a reversed axis (i.e., studies with small standard errors are at the top). Second, precision (i.e., 1 divided by the standard error) can be used. Standard errors on the y-axis should be preferred in most situations but precision might have advantages if one or few large studies (with high precision) should be compared to the results of smaller studies condensed at the bottom of the funnel plot (Sterne & Egger, 2001).

Egger's regression line

Egger's regression line (Egger, Smith, Schneider & Minder, 1997) can be displayed if the standard error is used on the y axis. Classic Egger's regression can be computed as the OLS estimator of regressing the standardized effect size (effect size divided by its standard error) on precision (1 divided by the standard error). Showing this line in the funnel plot can further help to visually assess funnel plot asymmetry.

Trim and fill analysis

Imputed studies by the trim-and fill method, as well as the adjusted summary effect (Duval & Tweedie, 2000) can be displayed. The trim-and fill algorithm basically estimates the number of (extreme) studies responsible for funnel plot asymmetry. It then trims this number of (extreme) studies and computes the adjusted summary effect only considering the remaining studies. Finally, it imputes studies - presumably missing due to publication bias - by mirroring the trimmed (extreme) studies (driving the funnel plot asymmetry) around the (adjusted) summary effect. The user has to specify on which side of the funnel plot the trim-and fill method should impute missing studies (i.e., the direction were studies are presumably missing due to publication bias). To estimate the number of (extreme) studies responsible for funnel plot asymmetry the L estimator defined in Duval and Tweedie (2000) is used.


A funnel plot is created using ggplot2.


Michael Kossmeier* <>

Ulrich S. Tran* <>

Martin Voracek* <>

*Department of Basic Psychological Research and Research Methods, School of Psychology, University of Vienna


Duval, S., & Tweedie, R. (2000). Trim and fill: a simple funnel-plot-based method of testing and adjusting for publication bias in meta-analysis. Biometrics, 56, 455-463.

Egger, M., Smith, G. D., Schneider, M., & Minder, C. (1997). Bias in meta-analysis detected by a simple, graphical test. Bmj, 315, 629-634.

Langan, D., Higgins, J. P., Gregory, W., & Sutton, A. J. (2012). Graphical augmentations to the funnel plot assess the impact of additional evidence on a meta-analysis. Journal of clinical epidemiology, 65, 511-519.

Peters, J. L., Sutton, A. J., Jones, D. R., Abrams, K. R., & Rushton, L. (2008). Contour-enhanced meta-analysis funnel plots help distinguish publication bias from other causes of asymmetry. Journal of clinical epidemiology, 61, 991-996.

Sterne, J. A., & Egger, M. (2001). Funnel plots for detecting bias in meta-analysis: guidelines on choice of axis. Journal of clinical epidemiology, 54, 1046-1055


# Create a funnel plot using confidence and significance contours
viz_funnel(x = mozart[, c("d", "se")])

# Show a trim-and-fill analysis and Egger's regression line:
viz_funnel(x = mozart[, c("d", "se")], contours = TRUE,
trim_and_fill = TRUE, trim_and_fill_side = "left", egger = TRUE)

# Plot log-odds-ratios on the original OR scale and show additional evidence contours:
viz_funnel(x = exrehab[, c("logor", "logor_se")], sig_contours = FALSE,
addev_contours = TRUE, contours_col = "Greys", xlab = "Odds Ratio",
x_trans_function = exp, x_breaks = log(c(0.125, 0.25, 0.5, 1, 2, 4, 8)))

# Show study subgroups
viz_funnel(x = mozart[, c("d", "se")], group = mozart[, "unpublished"],
group_legend_title = "unpublished?")

Example output

metaviz documentation built on April 14, 2020, 7:16 p.m.