Lets say I want to take the usual funnel plot for meta-analysis, and add another dimension to it, visually changing the points used for each study by a covariate. While it might be easier to change the marker or color for categorical variables, for a continuous variable, this gets a little harder.

Lets say we want to see if there's obvious asymmetry not just overall, but by say, length of follow-up. Does anyone know a way in either R or Stata to either change the size of the points plotted - so you essentially have a funnel-bubble plot, or to color them on a continuous gradient?

Clearly, this can be done by just modifying a scatterplot, but I'd like to save the steps in manipulating the access to get it looking like a conventional funnel plot.


You can do that with the funnel() function from the metafor package. Here is an example:


res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR", method="REML")

ablat.scaled <- with(dat.bcg, (ablat - min(ablat))/(max(ablat) - min(ablat)))
ablat.scaled <- ablat.scaled * 2 + 0.5

funnel(res, cex=ablat.scaled)

Resulting figure shown below. Adapt to your taste.

funnel plot with asymmetrical point sizes

  • $\begingroup$ Outstanding! Two questions - is there any chance you can go through what the code does a little bit? I confess R is still a touch...opaque to me. Secondarily, can metafor calculate measures of funnel plot asymmetry using those weighted points? $\endgroup$ – Fomite Sep 12 '11 at 23:52
  • $\begingroup$ Answering my own question, it appears that metafor can handle modifying factors (like whatever the points are scaled by) as part of a regression test of funnel plot asymmetry. Could you confirm my understanding is correct? $\endgroup$ – Fomite Sep 13 '11 at 3:19
  • $\begingroup$ Regarding what the code does: data(dat.bcg) to load the dat.bcg dataset. With res <- rma(...), I am fitting a random-effects model, specifying the counts of the 4 cells of the 2x2 tables in the studies. I set measure="RR" so that the (log) relative risk is used as the outcome measure for the meta-analysis. In the next two lines, I just take some variable and rescale it so that the smallest value is 0.5 and the largest 2.5. This gives me something that I can supply to the cex argument to indicate the point sizes. $\endgroup$ – Wolfgang Sep 13 '11 at 21:51
  • $\begingroup$ Regarding measures of funnel plot asymmetry: You can do the regression and rank correlation test (functions regtest and ranktest). The regression test allows you to specify a model that already includes one or more covariates/moderators (such as length of follow-up). $\endgroup$ – Wolfgang Sep 13 '11 at 21:56
  • $\begingroup$ Sorry for the resurrection, but I've been reading through the article on metafor. As I understand it, regtest and ranktest can use the covariates/moderators to try to explain some of the asymmetry. What I'm looking for is a way to weight the studies by a moderator. So for example, if one study had 10 years of followup, and another had 5, the first study would count twice. If all the heavily weighted studies appeared on one side of the funnel it would be asymmetrical, even if the unweighted version wasn't. Any idea how to approach that? $\endgroup$ – Fomite Sep 21 '11 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.