3
$\begingroup$

I'm trying to draw a forest plot after a multi-level meta-analysis that adds diamonds (polygons) for each of my subgroups (different intervention types). I have followed this code: http://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups, but my polygons and effect size estimates for subgroups are quite off. I think they have to be adjusted with the 'row' specifications, however, I don't understand the underlying logic of these. Any suggestions on how to adapt the below code to make the forest plot look neat and to have the diamonds appear below each separate subgroup?

MLMSavings <- rma.mv(yi=Hedge_G, V= V_g, data=Savings, random=list(~1|esid, ~1|Study._ID),  slab=paste(Study_name))



par(mar=c(2,2,2,2))
 forest(MLMSavings, main="Savings",   cex=1.2, showweights = T, xlim=c(-1.5, 1.5), at=c(-0.8, -0.6, - 0.4 , -0.2, 0, 0.2, 0.4, 0.6, 0.8),order=order(Savings$Intervention_TYPE), rows=c(1:14,15:16,17:22,23:30), xlab ="Hedges' g Values", mlab="Grand Mean" )
 par(font=1)
  text(-1.3, 34, "Study Reference", pos = 1, font = 2)
  text (1.03, 34, "Weight", pos=1,font =2)
 text(1.3, 34, "Hedge's G [95% CI]", pos = 1, font = 2)
 abline(h = 0)




op <- par(cex=.75, font=1)
 text(-1.3, c(24,16,5), pos=4, c("Bank Account",
                                "Financial Literacy",
                                "Saving Group",
                                "Multi-Component"))




MLMSavings1<- rma.mv(yi=Hedge_G, V= V_g, data= Savings,  random=list(~1|esid, ~1|Study._ID), subset=(Intervention_TYPE== 1)) 
 MLMSavings2<- rma.mv(yi=Hedge_G, V= V_g, data= Savings,  random=list(~1|esid, ~1|Study._ID), subset=(Intervention_TYPE==2)) 
 MLMSavings3<- rma.mv(yi=Hedge_G, V= V_g, data= Savings,  random=list(~1|esid, ~1|Study._ID), subset=(Intervention_TYPE==3)) 
 MLMSavings4<- rma.mv(yi=Hedge_G, V= V_g, data= Savings,  random=list(~1|esid, ~1|Study._ID), subset=(Intervention_TYPE==4)) 


 addpoly(MLMSavings1,  row= -2, cex=.75, atransf=exp, mlab="Random Effects Model for Subgroup")
 addpoly( MLMSavings2,  row= -2, cex=.75, atransf=exp, mlab="Random Effects Model for Subgroup")
 addpoly( MLMSavings3, row = -2, cex=.75, atransf=exp, mlab="Random Effects Model for Subgroup")
 addpoly( MLMSavings4,  row= -2, cex=.75, atransf=exp, mlab="Random Effects Model for Subgroup")*
$\endgroup$

closed as off-topic by mdewey, Peter Flom Apr 30 '17 at 12:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – mdewey, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ You should not be exponentiating Hedges' g values (i.e., remove the atransf=exp). And you should be using different values for row in addpoly(). Otherwise you are just plotting all of those polygons on top of each other. $\endgroup$ – Wolfgang Jul 11 '16 at 21:37
  • $\begingroup$ Thanks, that is already really useful. But any suggestion on how I can use row in addploy() to insert the polygons at the right place? Do the rows correspond to number of studies in my analysis? $\endgroup$ – Janina Steinert Jul 12 '16 at 14:10
  • 3
    $\begingroup$ You are copying the example too literally. In your call to forest you need to tell it which rows to use for the individual study estimates leaving gaps at appropriate places. Then when you use addpoly you supply it with the row numbers which you carefully left blank in the call to forest. $\endgroup$ – mdewey Jul 12 '16 at 16:56
  • $\begingroup$ Got it. Thanks so much. Surprised that R doesn't provide a more convenient way to plot this. Stata spits out a forest plot with subgroups in a second, however, not for a multi-level meta-analysis... $\endgroup$ – Janina Steinert Jul 12 '16 at 20:45
  • $\begingroup$ There is always a trade-off between convenience and flexibility. In metafor, forest() and addpoly() are very flexible. But you have to do more 'manual' work. That's how I designed it. $\endgroup$ – Wolfgang Jul 12 '16 at 21:37