Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Meta forestplot blank rows

    Dear Statslists,

    I am generating a forestplot with meta forestplot using pre-calculated effect sizes and 95%CIs. My issue is that there are four or so empty rows below my results (see image) and I can't figure out how come.
    The way I have done it is to meta set beta lowerCI upperCI then passing that onto meta forestplot.
    Does anyone have an idea about what is going on and which options could fix this?
    I checked in Graph editor and there aren't any empty variables/rows/placeholders.

    Here is the code:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(b pvalue ll ul) float srt str25 model2
     .11495584143759274  .4183045529215377 -.1642465281891688  .3941582110643543 1 "Variable 123"   
    -.04214957519725289  .9090101254550553 -.7682093145893415  .6839101641948356 2 "Variable 243543"
     -.0866248478544172  .6186846632721203 -.4301928875745232 .25694319186568876 3 "Variable 3"     
    -.15665919818706597  .4351288338055107 -.5518875914732493  .2385691950991174 4 "Variable 46546" 
    -.20338747138047936 .43754014106937267 -.7187836146064075  .3120086718454487 5 "Variable 5"     
    end
    label var b "b" 
    label var pvalue "p-value" 
    label var ll "ll" 
    label var ul "ul" 
    label var model2 " " 
    
    
    
    meta set b ll ul
    meta forestplot model _plot _esci pvalue, sort(srt) columnopts(_esci , format(%9.2f) supertitle("") title(β [95%CI])) columnopts(pvalue, format(%9.3f)) itemopts(j(left)) nooverall nullrefline nonotes
    Click image for larger version

Name:	SampleForestplot.png
Views:	1
Size:	65.6 KB
ID:	1756104

    Last edited by Wei Hai Deng; 13 Jun 2024, 06:27.

  • #2
    There should be a cleaner way to do this, but you can force a negative bottom margin. The CI column needs a different value from the rest of the columns, so you can fiddle with this.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(b pvalue ll ul) float srt str25 model2
     .11495584143759274  .4183045529215377 -.1642465281891688  .3941582110643543 1 "Variable 123"  
    -.04214957519725289  .9090101254550553 -.7682093145893415  .6839101641948356 2 "Variable 243543"
     -.0866248478544172  .6186846632721203 -.4301928875745232 .25694319186568876 3 "Variable 3"    
    -.15665919818706597  .4351288338055107 -.5518875914732493  .2385691950991174 4 "Variable 46546"
    -.20338747138047936 .43754014106937267 -.7187836146064075  .3120086718454487 5 "Variable 5"    
    end
    label var b "b"
    label var pvalue "p-value"
    label var ll "ll"
    label var ul "ul"
    label var model2 " "
    
    meta set b ll ul
    meta forestplot model _plot _esci pvalue, sort(srt) columnopts(_esci , format(%9.2f) ///
    supertitle("") title(β [95%CI])) columnopts(pvalue, format(%9.3f)) itemopts(j(left)) ///
    columnopts(model _plot pvalue, plotregion(margin(0 0 -5000 0))) ///
    columnopts(_esci, plotregion(margin(0 0 -14000 0))) ///
    nullrefline nonotes nooverall xline(0, lcolor(gray) noextend)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	16.5 KB
ID:	1756139

    Comment


    • #3
      Another option is to reduce a bit the blank space, and put labels. That's what I do in my projects:

      Code:
      meta forestplot model _plot _esci pvalue, xticks(-0.75(0.5)0.75, tlength(1)) ///
      xlabel(-1(0.5)1, format(%9.1f)) sort(srt) columnopts(_esci , format(%9.2f) supertitle("") ///
      title(β [95%CI])) columnopts(pvalue, format(%9.3f)) itemopts(j(left)) ///
      nooverall nullrefline nonote noohetstats noohomtest  noosigtest   noghetstats  nogwhomtests ///
       nogbhomtests    nullrefline(favorsleft("Favors whatever",size(9))  favorsright("Favors whatever",size(9)) )

      Comment

      Working...
      X