Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 7 down vote accepted

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,, measure="RR", method="REML")

ablat.scaled <- with(, (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

share|improve this answer
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? – Fomite Sep 12 '11 at 23:52
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? – Fomite Sep 13 '11 at 3:19
Regarding what the code does: data( to load the 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. – Wolfgang Sep 13 '11 at 21:51
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). – Wolfgang Sep 13 '11 at 21:56
Thanks again :) – Fomite Sep 13 '11 at 22:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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